@Serbin wrote:
Hi,
I’m currently trying to manually threshold an image so that I can threshold a HSV image based on color of objects. To begin I’ve got a simple threshold like so:
for (int i=0; i<(hsvImg.height+hsvImg.width)*3; i+=3){
if (hsvImg.getPixels()[i+2]>100){
thresholdImg.getPixels()[i/3] = 255;
} else {
thresholdImg.getPixels()[i/3] = 0;
}
cout << "Thresholded value: " << static_cast(bckgrndHueDiffImg.getPixels()[i/3]) << endl;
}Which should threshold every pixel above brightness 100 to white and everything below it to black, which I then run a contour finder on.
The problem I have is that the thresholded value put the the console is either 255 or 0 as expected, but the image when drawn to the screen is pure black and the contour finder finds nothing.
Is there something I’m missing with the ofxOpenCv implementation?
Any help is appreciated, thanks in advance.
Posts: 4
Participants: 2