Reputation: 345
I'm writing code with visual c++ using opencv libraries. I need to threshold some different images all with a line in evidence (is clearer) but I'm having some problems because the lighting changes in every image and I use a fixed threshold so it's very difficult. Someone knows opencv' functions able to face that?
Upvotes: 2
Views: 624
Reputation: 515
Use : threshold(imageIn, imageOut, 100, 255, CV_THRESH_OTSU);
The OTSU method is the one used in Matlab, it adapts to the image's histogram and takes the best value to separate it into two distinc bins. Don't worry about the '100' value, OTSU overwrites it.
Upvotes: 3
Reputation: 3047
Yes, try AdaptiveThreshold. For the actual threshold parameter, choose a negative number. Good luck!
Upvotes: 2