Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Same output threshold image

$
0
0
I use three filter as below, each one if I run individual work well(three output image 'imgThresholded' is difference), but if I use continuously all, the output image 'imgThresholded' is the last one. void filterBlack(){ inRange(imgHSV, Scalar(Hblack.iLVal / 2, Sblack.iLVal, Vblack.iLVal*2.55), Scalar(Hblack.iHVal / 2, Sblack.iHVal*2.55, Vblack.iHVal*2.55), imgThresholded); erode(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(3, 3))); dilate(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(3, 3))); //morphological closing (fill small holes in the foreground) dilate(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(3, 3))); erode(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(3, 3))); imshow(thhdWindow, imgThresholded); } void filterBlue(){ inRange(imgHSV, Scalar(Hblue.iLVal / 2, Sblue.iLVal, Vblue.iLVal*2.55), Scalar(Hblue.iHVal / 2, Sblue.iHVal*2.55, Vblue.iHVal*2.55), imgThresholded); erode(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(3, 3))); dilate(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(3, 3))); //morphological closing (fill small holes in the foreground) dilate(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(3, 3))); erode(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(3, 3))); imshow(thhdWindow, imgThresholded); } void filterRed(){ inRange(imgHSV, Scalar(Hred.iLVal / 2, Sred.iLVal, Vred.iLVal*2.55), Scalar(Hred.iHVal / 2, Sred.iHVal*2.55, Vred.iHVal*2.55), imgThresholded); erode(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(3, 3))); dilate(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(3, 3))); //morphological closing (fill small holes in the foreground) dilate(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(3, 3))); erode(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(3, 3))); imshow(thhdWindow, imgThresholded); }

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>