This week's book giveaway is in the Kotlin forum. We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line! See this thread for details.
What do you want to achieve exactly? Take the (A)RGB value of each pixel (x,y) in both images, perform the operation on those two values, then set the result of that operation for a new image?
If so, look at BufferedImage. It allows you to get and set individual pixel values using getRGB and setRGB. Use ImageIO.read to create BufferedImage objects from files.
Whatever it is he wants, it's probably achievable with AlphaComposite or BlendComposite. If so, there's no need to reinvent the wheel (unless of course if this is homework).
luck, db
There are no new questions, but there may be new answers.
sachin upatil
Greenhorn
Posts: 29
posted 7 years ago
I want to do this logical operation (as shown in image screenshot) on binary image ?
I did it using BufferedImage. I take the each pixel from two images and do logical operation on that pixel and setting that pixel.(used getRGB and setRGB).
the result i get attached as LogicalOPeration.
what's wrong with AND and OR operation in my result ?
Now we see what you want, AlphaComposite is what you should use. If we define IMG_1 as the source and IMG_2 as the destination, you can use the following rules:
- SRC_IN for AND
- SRC_OVER for OR
- CLEAR for XOR
- DST_OUT for NOT-AND