checking background color

Posted by Safaa Al-Haj Saleh on
URL: http://imagej.273.s1.nabble.com/checking-background-color-tp5007298.html

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