Image Processing in Java
Hello friends, I m facing an problem in image processing which is an part of my final year project. I want to manipulate pixels of an image, such as change color, recognize certain areas within an image based on pixel values etc. Can someone help me out.
Use buffered images (java.awt.image.BufferedImage).
Constructor: BufferedImage(width, height, image type)
I would recommend BufferedImage.TYPE_INT_ARGB as image type, but where are other types.
img.createGraphics() creates a Graphics2D.
img.getRGB(x, y) gets a pixel's colour.
img.setRGB(x, y, colour) sets a pixel's colour.
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB)
int argbValue = img.getRGB(x, y); //gets the colour on a pixel
alpha = ?
red = ?
green = ?
blue = ?
argbValue = alpha << (3 * 8)
argbValue += red << (2 * 8)
argbValue += green << (1 * 8)
argbValue += blue << (0 * 8)
img.setRGB(x, y, argbValue); //sets the colour on a pixel
If you handle pixel-per-pixel editing, take a look at http://download.oracle.com/javase/1.5.0/docs/api/java/awt/image/BufferedImage.html#getRGB(int, int, int, int, int, int, int).
Hi i was just wondering if that answer had resolved thr question for you?
Yeah, quite a bit ....if someone has other solutions, they are most welcome ...
Have you tried Java Advanced Imaging Java Advanced Imaging (JAI) API
I haven't tried it, but it could be something.
Thank u @Hibernate. Java Advanced Imaging is quite useful from my project point of view. Do u have good knowledge about image processing. I need help to sort out few issues in image processing. Do reply.
I have never used JAI, but post your issue and maybe someone can help you.