1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

Make sure Truco is launched on non-empty and CV_8UC1 only.

This is checked in the function:
https://github.com/opencv/opencv/blob/3bb68212dac2e1c42e7910de9daf3a0766eaead8/modules/imgproc/src/contours_truco.cpp#L621
This commit is contained in:
Vincent Rabaud
2026-05-27 17:52:11 +02:00
parent 3bb68212da
commit 8ebcf229a1
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -649,7 +649,7 @@ void cv::findContours(InputArray _image,
}
// Fast path: RETR_LIST without hierarchy → findTRUContours (parallel contour extraction)
if (mode == RETR_LIST && !_hierarchy.needed())
if (mode == RETR_LIST && !_hierarchy.needed() && _image.type() == CV_8UC1)
{
// findTRUContours requires FOREGROUND=255; binarize=true thresholds the padded
// image in-place, avoiding an extra allocation (findContours accepts any non-zero value)
+1 -1
View File
@@ -618,7 +618,7 @@ void findTRUContours(InputArray _src, OutputArrayOfArrays _contours, int minSize
{
CV_INSTRUMENT_REGION();
Mat src = _src.getMat();
CV_Assert(!src.empty() && src.type() == CV_8UC1);
CV_Assert(src.type() == CV_8UC1);
// Buffer handling
cv::Mat padded;