e675. 翻转缓冲图像

// To create a buffered image, see e666 创建缓冲图像

    // Flip the image vertically
    AffineTransform tx = AffineTransform.getScaleInstance(1, -1);
    tx.translate(0, -image.getHeight(null));
    AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
    bufferedImage = op.filter(bufferedImage, null);

    // Flip the image horizontally
    tx = AffineTransform.getScaleInstance(-1, 1);
    tx.translate(-image.getWidth(null), 0);
    op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
    bufferedImage = op.filter(bufferedImage, null);

    // Flip the image vertically and horizontally;
    // equivalent to rotating the image 180 degrees
    tx = AffineTransform.getScaleInstance(-1, -1);
    tx.translate(-image.getWidth(null), -image.getHeight(null));
    op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
    bufferedImage = op.filter(bufferedImage, null);
Related Examples

原文地址:https://www.cnblogs.com/borter/p/9575522.html

时间: 2024-10-15 13:59:36

e675. 翻转缓冲图像的相关文章

code第一部分数组:第十五题 矩阵翻转(图像翻转)

code第一部分数组:第十五题 矩阵翻转(图像翻转) 首先想到,纯模拟,从外到内一圈一圈的转,但这个方法太慢.如下图,首先沿着副对角线翻转一次,然后沿着水平中线翻转一次. 源代码 #include <iostream> #include <vector> using namespace std; //引用类型形参 void swap(int &n,int &m) { int temp=n; n=m; m=temp; } //指针类型形参 void swap1(int

e666. 创建缓冲图像

A buffered image is a type of image whose pixels can be modified. For example, you can draw on a buffered image and then draw the resulting buffered image on the screen or save it to a file. A buffered image supports many formats for storing pixels.

图像预处理之图像翻转、图像色彩调整

图像翻转  tf.image.flip_up_down:上下翻转 tf.image.flip_left_right:左右翻转 tf.image.transpose_image:对角线翻转 除此之外,TensorFlow还提供了随机翻转的函数,保证了样本的样本的随机性: tf.image.random_flip_up_down:随机上下翻转图片 tf.image.random_flip_left_right:随机左右翻转图片 图像色彩调整  亮度: tf.image.adjust_brightne

e669. 绘制缓冲图像

To draw on a buffered image, create a graphics context on the buffered image. // Create a graphics context on the buffered image Graphics2D g2d = bimage.createGraphics(); // Draw on the image g2d.setColor(Color.red); g2d.fill(new Ellipse2D.Float(0, 0

e667. 在给定图像中创建缓冲图像

An Image object cannot be converted to a BufferedImage object. The closest equivalent is to create a buffered image and then draw the image on the buffered image. This example defines a method that does this. // This method returns a buffered image w

e668. 在一组像素中创建缓冲图像

This example demonstrates how to convert a byte array of pixel values that are indices to a color table into a BufferedImage. In particular, the example generates the Mandelbrot set in a byte buffer and combines this data with a SampleModel, ColorMod

e671. 在缓冲图像中存取像素

// Get a pixel int rgb = bufferedImage.getRGB(x, y); // Get all the pixels int w = bufferedImage.getWidth(null); int h = bufferedImage.getHeight(null); int[] rgbs = new int[w*h]; bufferedImage.getRGB(0, 0, w, h, rgbs, 0, w); // Set a pixel rgb = 0xFF

BMP RGB888转RGB565 +上下翻转+缩放

典型的BMP图像文件由四部分组成: (1) 位图头文件数据结构,它包含BMP图像文件的类型.文件大小和位图起始位置等信息: typedef struct tagBITMAPFILEHEADER { WORD bfType;//位图文件的类型,必须为BM(1-2字节) DWORD bfSize;//位图文件的大小,以字节为单位(3-6字节,低位在前) WORD bfReserved1;//位图文件保留字,必须为0(7-8字节) WORD bfReserved2;//位图文件保留字,必须为0(9-1

Mac上的尖端图像查看器—EdgeView2,装机必备神器!

在Mac上一直以来有这样一个问题,那么就是看图片无法翻页,自带的文件管理器太差了,不够直观.那么有没有办法解决这个问题的呢?当然有,今天小编就给大家带来的一款Mac上的尖端图像查看器EdgeView2,它能轻松帮我们解决这个问题.快跟小编一起来看看EdgeView2的强大功能吧! ---图像查看器 -支持JPG,GIF,BMP,psD,TIFF,RAW(DNG)和PDF等图像文件支持主要的存档格式,如ZIP,RAR,CBZ,CBR,7zip,ALZ等.可以提取加密的存档文件可以在归档中读取归档文