Ask Your Question

Revision history [back]

Contours of height 1 and moment

Hi,

I have got this program

Mat grayscaleImage;

Mat imgOrig = imread("BLOB_MSER.bmp", IMREAD_UNCHANGED)
cvtColor(imgOrig, grayscaleImage, COLOR_BGR2GRAY);

Mat binarizedImage;
threshold(grayscaleImage, binarizedImage, 20, 255, THRESH_BINARY);
std::vector < std::vector<Point> > contours;
Mat tmpBinaryImage = binarizedImage.clone();
findContours(tmpBinaryImage, contours, RETR_LIST, CHAIN_APPROX_NONE);
Moments moms = moments(Mat(contours[20]));

For contours[20] I have got 1076 points but all moments are 0. What's wrong? When I call SimpleBlobDetector with this image I have got an exception for this contour

data are here

Thanks for your help