Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing Image pixel by pixel in Java

Tags:

java

Is there any inbuilt java API or class library for accessing pixels in a given image? What I am planning to do is search one image inside another image. For example : img1 is 24x24px , img2 is 1024x768px assume that a symbol, similar to img1 may exists in img2 . Now I want to get X and Y coordinates of the symbol which is similar to the img1.

like image 790
Kanishka Dilshan Avatar asked Dec 16 '22 19:12

Kanishka Dilshan


1 Answers

Yes, there is, if you have your image as a BufferedImage then use the getRGB(int x, int y) method to get the value of the pixel at the position (x, y).

See the API documentation of java.awt.image.BufferedImage.

like image 177
Jesper Avatar answered Jan 03 '23 04:01

Jesper