Java:从图像中裁剪出具有特定颜色的区域 [英] Java: Crop out an area with specific color from an image

查看:415
本文介绍了Java:从图像中裁剪出具有特定颜色的区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以裁剪出具有指定颜色的图像区域?

I was wondering if there is a way to crop out an area of an image with a specified color?

我有一个图像,它是一个画布区域,上面有实际图像,我想删除画布"区域,只保留实际图像.

I have an image which is a canvas area with an actual image on it and I want to remove the "canvas" area and be left only with the actual image.

欢呼

推荐答案

如果您的图片具有明显区别",请从此 answer 背景色,请使用 LookupOp 具有四个组成部分的LookupTable,用于将与背景色匹配的颜色的alpha组成部分设置为零."

From this answer, if your image has a "distinct background color, use a LookupOp with a four-component LookupTable that sets the alpha component to zero for colors that match the background."

附录:另请参见

Addendum: See also Using the Java 2D LookupOp Filter Class to Process Images and Image processing with Java 2D.

这篇关于Java:从图像中裁剪出具有特定颜色的区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆