1 Attachment(s)
Recognize Black Pixel of a Threshold Image
I need to recognize and print coordinates of the black pixels present in a threshold image which means image only consist of Black and White pixels. Please somebody help me with the implementation. (Sample threshold-ed image is attached)
Code:
public void recogniseBlackPixels(BufferedImage img){
BufferedImage tempImage = img;
for (int ix = 0; ix<tempImage.getWidth();ix++){
for(int iy = 0;iy<tempImage.getHeight();iy++){
if(pixel == black){ // This is only a logical representation
System.out.println("Codinate of the black pixel : - "+ix+" "+iy);
// Please help me to implement if block
}
}
}
}
I hope this logic will work fine to achieve my goal. Please somebody help me with this.
Thank you in advance......