Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2009
    Posts
    34
    Rep Power
    0

    Default 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)

    Java 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......
    Attached Thumbnails Attached Thumbnails Recognize Black Pixel of a Threshold Image-1.jpg  
    Last edited by LankanSniper; 12-04-2009 at 06:57 AM.

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    Java Code:
    BufferedImage image ...
    int blackRGB = Color.black.getRGB();
    for (int ix = 0; ix<tempImage.getWidth();ix++){
        for(int iy = 0;iy<tempImage.getHeight();iy++){
            if(image.getRGB(ix, iy) == blackRGB){

Similar Threads

  1. Scanning Image Pixel by Pixel
    By the_transltr in forum Advanced Java
    Replies: 5
    Last Post: 08-28-2012, 04:01 PM
  2. Identify pixel in the image.
    By Maiquelnet in forum Java 2D
    Replies: 2
    Last Post: 11-12-2009, 07:55 PM
  3. Replies: 14
    Last Post: 04-10-2009, 08:46 AM
  4. Why this image background is black ?
    By samson in forum Java 2D
    Replies: 1
    Last Post: 07-17-2007, 04:24 AM
  5. Replies: 1
    Last Post: 07-17-2007, 04:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •