We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the code: ` //TestDLL.c : test of CvBlob DLL
cv::Mat img = cv::imread("test.png", 1); cv::Mat grey; grey.create(img.size(), CV_8UC1); cv::cvtColor(img, grey, CV_BGR2GRAY, 1); cv::threshold(grey, grey, 0, 255, CV_THRESH_BINARY + CV_THRESH_OTSU); LARGE_INTEGER freq; LARGE_INTEGER t0, tF, tDiff; double elapsedTime; // cvblob QueryPerformanceFrequency(&freq); QueryPerformanceCounter(&t0); cvb::BlobList blobs; cvb::Label max_label = 250; blobs.SimpleLabel(grey, max_label); blobs.FilterByArea(10, img.cols * img.rows); QueryPerformanceCounter(&tF); tDiff.QuadPart = tF.QuadPart - t0.QuadPart; elapsedTime = tDiff.QuadPart / (double) freq.QuadPart; std::cout << "cvblob:" << elapsedTime << std::endl; for (auto &a_blob : blobs.get_BlobsList()) { // extract and draws blob contour auto contours = a_blob->get_Contour().get_ContourPolygon(); if (contours.size() != 1) { for (auto &iter = contours.begin(); iter != contours.end(); iter++) { auto next_iter = iter; next_iter++; if (next_iter == contours.end()) cv::line(img, *iter, contours[0], cv::Scalar(0, 0, 255), 1, 8); else cv::line(img, *iter, *next_iter, cv::Scalar(0, 0, 255), 1, 8); } } // extract and draws every blob internal hole contour auto internal_contours = a_blob->get_InternalContours(); for (auto &a_contour : internal_contours) { auto contour_dot = a_contour->get_ContourPolygon(); if (contour_dot.size() == 1) continue; for (auto &iter = contour_dot.begin(); iter != contour_dot.end(); iter++) { auto next_iter = iter; next_iter++; if (next_iter == contour_dot.end()) cv::line(img, *iter, contour_dot[0], cv::Scalar(0, 255, 0), 1, 8); else cv::line(img, *iter, *next_iter, cv::Scalar(0, 255, 0), 1, 8); } } // draws bounding box cv::rectangle(img, a_blob->get_BoundingBox(), cv::Scalar(255, 0, 255)); // draws centroid cv::circle(img, a_blob->get_Centroid(), 2, cv::Scalar(255, 0, 0), 2); }; cv::imwrite("imggray.png", grey); cv::imwrite("imgout.png", img); cv::Mat labeImgTemp = blobs.get_ImageLabel() *24; cv::imwrite("imglabelMat.png", labeImgTemp); return 0;
` In the picture(imglabelMat.png), the label values are discontinuous. imglabelMat.png: imggray.png: imgout.png:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
the code:
`
//TestDLL.c : test of CvBlob DLL
`



In the picture(imglabelMat.png), the label values are discontinuous.
imglabelMat.png:
imggray.png:
imgout.png:
The text was updated successfully, but these errors were encountered: