<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><br></div><div class="yahoo_quoted" style="display: block;"><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><div style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"><div dir="ltr"> </div>  <div class="y_msg_container"><div id="yiv4995286293"><div><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><div>Hi all,</div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">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)</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">I have done this so far:</div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:'times
 new roman', 'new york', times, serif;background-color:transparent;font-style:normal;"><br></div><div style="background-color:transparent;">ImageProcessor imp = clustering_result.getProcessor();</div><div style="background-color:transparent;">                  </div><div style="background-color:transparent;">                  if(Prefs.blackBackground==false){</div><div style="background-color:transparent;">                  imp.invert();</div><div style="background-color:transparent;">                  </div><div style="background-color:transparent;">                  clusteredImage=imp.getBufferedImage();</div><div style="background-color:transparent;">               
   }</div><div style="background-color:transparent;">                  </div><div style="background-color:transparent;">                  else {</div><div style="background-color:transparent;"><span style="background-color:transparent;font-size:12pt;">                  clusteredImage=imp.getBufferedImage();</span><br></div><div style="background-color:transparent;">                  }</div><div style="background-color:transparent;">                 </div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times,
 serif; background-color: transparent; font-style: normal;">But it does not work! Any help please?</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">Regards,</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">Safaa</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><br></div></div></div></div><br><br></div>  </div> </div>  </div> </div></body></html>