没有合适的资源?快使用搜索试试~ 我知道了~
java 实现图像浮雕的方法
5星 · 超过95%的资源 需积分: 18 30 下载量 62 浏览量
2009-05-16
15:48:41
上传
评论
收藏 1KB TXT 举报
温馨提示
试读
2页
java 图像浮雕的方法,资料比较少,拿上来共享下
资源推荐
资源详情
资源评论
public BufferedImage emboss(BufferedImage src) {
int width = src.getWidth();
int height = src.getHeight();
BufferedImage dst;
dst = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
for (int i = 0; i < height; i++)
for (int j = 0; j < width; j++) {
int upperLeft = 0;
int lowerRight = 0;
if (i > 0 && j > 0)
upperLeft = src.getRGB(j - 1, i - 1);
if (i < height - 1 && j < width - 1)
lowerRight = src.getRGB(j + 1, i + 1);
int redDiff = ((lowerRight >> 16) & 255) - ((upperLeft >> 16) & 255);
int greenDiff = ((lowerRight >> 8) & 255) - ((upperLeft >> 8) & 255);
int blueDiff = (lowerRight & 255) - (upperLeft & 255);
int diff = redDiff;
if (Math.abs(greenDiff) > Math.abs(diff))
diff = greenDiff;
if (Math.abs(blueDiff) > Math.abs(diff))
diff = blueDiff;
int width = src.getWidth();
int height = src.getHeight();
BufferedImage dst;
dst = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
for (int i = 0; i < height; i++)
for (int j = 0; j < width; j++) {
int upperLeft = 0;
int lowerRight = 0;
if (i > 0 && j > 0)
upperLeft = src.getRGB(j - 1, i - 1);
if (i < height - 1 && j < width - 1)
lowerRight = src.getRGB(j + 1, i + 1);
int redDiff = ((lowerRight >> 16) & 255) - ((upperLeft >> 16) & 255);
int greenDiff = ((lowerRight >> 8) & 255) - ((upperLeft >> 8) & 255);
int blueDiff = (lowerRight & 255) - (upperLeft & 255);
int diff = redDiff;
if (Math.abs(greenDiff) > Math.abs(diff))
diff = greenDiff;
if (Math.abs(blueDiff) > Math.abs(diff))
diff = blueDiff;
资源评论
- xuhongshi5202012-06-15不错,算比较好的灰色浮雕算法了
- lonewolf0102014-10-31下了,不过,网上有这样的框架,各种效果,过滤器什么的。很好用。
- hqf_7772014-12-10东西还行 凑合用吧
- DavidHuang1232013-03-21这个是果真不错,可以调试,而且已经被我应用到自己的程序里面了
faanyu_2009
- 粉丝: 0
- 资源: 22
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功