How to draw irregular outline of MSER region?
I have detected MSER regions as follows(Thanks a lot for Alexander Shishkov's help!)
#include <opencv2/opencv.hpp>
int main(int argc, char *argv[])
{
Mat box = imread("box.png",1);
MSER ms;
vector<vector<Point>> regions;
ms(box, regions, Mat());
for (int i = 0; i < regions.size(); i++)
{
ellipse(box, fitEllipse(regions[i]), Scalar(255));
}
imshow("mser", box);
waitKey(0);
return 0;
}
Next step I try to draw irregular outlines of MSER regions which have been detected by the above code. This step I write code as follow:
int main(int argc, char *argv[])
{
Mat box = imread("box.png",1);
MSER ms;
vector<vector<Point>> regions;
ms(box, regions, Mat());
for (int i = 0; i < regions.size(); i++)
{
ellipse(box, fitEllipse(regions[i]), Scalar(255));
drawContours(box,regions,i,Scalar(0,255,255),1,8);//this was used to draw
//irregular outlines of MSER regions
}
imshow("mser", box);
waitKey(0);
return 0;
}
The result of above code show that the irregular interiors of MSER regions are drawn. But, I just need draw irregular outlines of MSER regions, not interiors, how I need use the function of drawContours, what should I do?
Could you explain what is the irregular outline of MSER regions on any simple example?