数字图像处理——用Java对图像做镜像变换
2017-05-31 22:27
239 查看
水平镜像变换,也就是把图像的像素点按照垂直中线做调换。
代码实现也很简单:
输入:
输出:
代码实现也很简单:
import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; public class ImageMirror { public static void main(String[] args) throws IOException{ File file = null; BufferedImage image = null; try { file = new File("E:\\in.jpg"); image = ImageIO.read(file); int width = image.getWidth(); int height = image.getHeight(); for (int j = 0; j < height; j++) { int l = 0, r = width - 1; while (l < r) { int pl = image.getRGB(l, j); int pr = image.getRGB(r, j); image.setRGB(l, j, pr); image.setRGB(r, j, pl); l++; r--; } } file = new File("E:\\out.jpg"); ImageIO.write(image, "jpg", file); } catch (IOException e) { e.printStackTrace(); } } }
输入:
输出:
相关文章推荐
- 【数字图像处理】六.MFC空间几何变换之图像平移、镜像、旋转、缩放详解
- 【数字图像处理】六.MFC空间几何变换之图像平移、镜像、旋转、缩放具体解释
- Java图像处理技巧四则-剪切,缩放,灰度变换,彩色变换
- JAVA 数字图像处理----非白即黑的灰,2B青年的自画像
- 【OpenCV数字图像处理】(3) 【Python编程】(3) 镜像
- Win8Metro(C#)数字图像处理--2.25二值图像距离变换
- 系统学习数字图像处理之灰度变换和空域滤波
- 数字图像处理--空间变换
- [数字图像处理]灰度变换——反转,对数变换,伽马变换,灰度拉伸,灰度切割,位图切割
- 数字图像处理-空间域图像增强(一)(图像反转,对数变换,幂次变换、分段线性变换)
- 数字图像处理—空域变换增强之滤波增强(模板操作)(模板卷积)
- Win8Metro(C#)数字图像处理--2.20图像垂直镜像
- Java实现数字图像处理的困惑
- [数字图像处理]灰度变换——直方图处理
- Java数字图像处理基础知识 - 必读
- 数字图像处理--空间变换
- 数字图像处理基本算法实现(1)--section3.2基本灰度变换
- [数字图像处理]简单的几何学图像变换与图像配准
- 数字图像处理——灰度变换与空间滤波(使用MFC)
- 数字图像处理--空间变换