I am trying to draw contours of an image using C++. It's giving error:
Bad Arguement(Unknown array type) in cv::cvarrTOMat.
So i switched to python and it's working fine there. Please help me figure out what's wrong with the code.
int main()
{
Mat src, dst,dst2,dst3;
src = imread("imagedata\\result0.jpg", 1);
resize(src, dst, Size(), 0.09, 0.09, INTER_LINEAR);
string s = "cropped.jpg";
imwrite(s , dst);
cvtColor(dst, dst2, CV_RGB2GRAY);
imwrite("cropped2.jpg", dst2);
vector< vector<Point> > contours;
vector<Vec4i> hierarchy;
findContours(dst2, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE);
drawContours(dst3, contours, -1 , (128,255,0), 3);//, hierarchy);
imwrite("cropped3.jpg", dst3);
return 0;
}