Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

drawing contour to any object of image

$
0
0
hi, my purpose is to draw a contour to surrounding the object which has a wanted color, I can detect any color from image and I know how to draw contour to surrounding of all objects in image , but for instance I don't know how I'm able to draw contour for only red object on the image with the program below... ![image description](/upfiles/1443608479785856.png) #include "stdafx.h" #include #include #include #include using namespace std; using namespace cv; Mat redFilter(const Mat& src){ Mat redOnly; cvtColor(src,redOnly,CV_BGR2HSV); inRange(src, Scalar(0, 0, 0), Scalar(0, 0, 255), redOnly); return redOnly; } int main(int argc, char** argv){ Mat input = imread("sekiller2.png"); imshow("input", input); Mat redOnly = redFilter(input); imshow("redOnly", redOnly); waitKey(); return 0; }

Viewing all articles
Browse latest Browse all 41027

Trending Articles



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