OpenCV Automatic Thresholding values [closed]
Hi all, I am trying to write a function for automatic threshold value but I don't know how to get them from histogram. For example the histogram of the H channel(blue one) of the original image says that the first maximum belongs to the background, the second to the skin and the last to the hematome. For example I have this input image: http://i61.tinypic.com/dblke0.jpg
I convert input img to other color space (HSV) then I split channels and then I print out on histogram all channels H-blue line, S-green line, V-red line. http://i61.tinypic.com/15ckh2b.jpg . How would I write a function to get automatic binarization (thresholding values)?
So based on the maxima in those histograms, you want to define the correct values for thresholding? You are looking for regional thresholds or a single threshold for the complete image?
Actualy I don't understand your question. :/ I have couple images of hematoma and for all of them I need different values for thresholding. I am trying to use some adaptive thresholding or a automatic one what can set values for thresholding by itself.
Hmm if local or global thresholding is not a known concept I suggest googling for thresholding techniques and start reading. It are very basic concepts.
Try using Otsu thresholding on any of the H,S,V/R,G,B and see if you get desired results.