checking background color

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

checking background color

Safaa Al-Haj Saleh
Hi all,

I am writing a code to check whether the background of a binary image is black or not. If the background is white, colors of the binary image are inverted (i.e. the color of the background should be always black)

I have done this so far:

ImageProcessor imp = clustering_result.getProcessor();
                  
                  if(Prefs.blackBackground==false){
                  imp.invert();
                  
                  clusteredImage=imp.getBufferedImage();
                  }
                  
                  else {
                  clusteredImage=imp.getBufferedImage();

                  }
                 

But it does not work! Any help please?

Regards,
Safaa


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: checking background color

utfryre33
To solve this, you need to check the actual pixel intensity at the corners or edges rather than just checking the global Prefs. In many gaming interfaces, like when you download 3 Patti Crown, consistent background detection is key for a smooth UI experience download free game. Try calculating the average intensity of the border pixels; if the value is high (near 255), then call imp.invert() to ensure the background stays black as intended.