I'm trying to detect the first valley in a 1D histogram, to use as a threshold point. (Processing dark to light / left to right)
Unfortunately some of the histograms have mini peaks, gaps and jagged edges. The algorithm I've written is getting stuck on these. I think I need to smooth away the rough edges as the peaks valleys I need are quite prominent.
Does anyone have some pointers on to the best way to smooth a 1D histogram in OpenCV?
This shows where the algorithm got caught on a jagged edge and failed:
http://applist.s3.amazonaws.com/junk/failed.png
Blue line: peak
Red line: valley