FindContour does not get all contour
Hello,
I'm working on one project and i'm dealing with big image 12000X28000 width x Height. In my project, i need to find contour, like this i can do some calculation to add or remove feature. But in some way OpenCV does not find all contour in my image this is my code and i'm using open cv 3.4.1 on C++ :
void ApplyDetectVertical(Mat & InputMat, Mat & OutputMat)
{
std::vector<std::vector<cv::Point>> vecContours;
cv::Mat outBin;
cv::threshold(
InputMat,
outBin,
0,
255,
cv::THRESH_BINARY | cv::THRESH_OTSU);
OutputMat = cv::Mat(outBin.size(), outBin.type(), Scalar(0));
// Find contour
cv::findContours(outBin, vecContours, cv::RETR_LIST, cv::CHAIN_APPROX_SIMPLE);
int nContourCount = vecContours.size();
cv::Scalar color = cv::Scalar(255, 255, 255);
// Find contour of interest
for (size_t i = 0; i < nContourCount; ++i) {
cv::drawContours(OutputMat,
vecContours, i++,
color,
cv::FILLED
/*cv::LINE_4*/);
}
imshow ("result", OutputMat);
}
this is my test image : https://photos.app.goo.gl/ELmszUKALYv... this my result : https://photos.app.goo.gl/q4Sbu2Nt0gu...
Thanks for your help
hi, can you try again to upload your images here, not to an external site ?
Are you sure that contours are not founded? You got so many contours that there is some aliasing effect in outputmat
@berak the image is to big for the site. i already tried. @LBerger, do you try the code in your installation? does it work?
I didn't try your code. I tried my code with your imge
@LBerger do you get all contour? how did you do?