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...

#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;
}
↧