title: finding Peaks in image Histogram
body: <p>I am witting a project of image processing.
  For some part of my project to find good threshold value I need to find peaks and valleys of image's histogram.
  I am witting my project in C# .net 
  but I need Algorithm or sample code in any languages like(Java, C,C++,....) to understand the logic of that. I can convert to C# by my self.
  any document or algorithm or piece of code...
  thanks</p>