Ask Your Question

Revision history [back]

Error findContours with mode RETR_TREE on CV_32SC1 images

Hi guys,

I was wondering why I can't use findContours with mode RETR_TREE on CV_32SC1 images. I would like to do following:

auto A = cv::imread("C:\\devel\\test_image.png", -1);
cv::Mat labels;
int no_labels = cv::connectedComponents(B, labels, 4, CV_32S);

std::vector<std::vector<cv::Point> > contours0;
std::vector<cv::Vec4i> hierarchy;

cv::findContours(labels, contours0, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_NONE);

Or is there a solution how to convert hierarchy from RETR_CCOMP to RETR_TREE?

Thanks for your time.

Error findContours with mode RETR_TREE on CV_32SC1 images

Hi guys,

I was wondering why I can't use findContours with mode RETR_TREE on CV_32SC1 images. I would like to do following:

auto A = cv::imread("C:\\devel\\test_image.png", -1);
cv::Mat labels;
int no_labels = cv::connectedComponents(B, cv::connectedComponents(A, labels, 4, CV_32S);

std::vector<std::vector<cv::Point> > contours0;
std::vector<cv::Vec4i> hierarchy;

cv::findContours(labels, contours0, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_NONE);

Or is there a solution how to convert hierarchy from RETR_CCOMP to RETR_TREE?

Thanks for your time.

Error findContours with mode RETR_TREE on CV_32SC1 images

Hi guys,

I was wondering why I can't use findContours with mode RETR_TREE on CV_32SC1 images. I would like to do following:

auto A = cv::imread("C:\\devel\\test_image.png", -1);
cv::Mat labels;
int no_labels = cv::connectedComponents(A, labels, 4, CV_32S);

std::vector<std::vector<cv::Point> > contours0;
std::vector<cv::Vec4i> hierarchy;

cv::findContours(labels, contours0, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_NONE);

Or is there a solution how to convert hierarchy from RETR_CCOMP to RETR_TREE?

Thanks for your time.