Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ANPR Algorithm example using OpenCV

Hi all,

I followed this example/tutorial about ANPR algorithm using OpenCV.

I downloaded c++ example code and I ported this code on iOS app.

Using some example photos, this code work well.

Now, I would to use the iPhone camera to take the photo to pass to the ANPR algorithm but oft I obtain an error (so also a crash). The error is this:

int area = floodFill(input, mask, seed, Scalar(255,0,0), &ccomp, Scalar(loDiff, loDiff, loDiff), Scalar(upDiff, upDiff, upDiff), flags); OpenCV Error: Unsupported format or combination of formats () in cvFloodFill, file /src/floodfill.cpp, line 621

floodFill function is used in this context:

Mat mask;
        mask.create(input.rows + 2, input.cols + 2, CV_8UC1);
        mask= Scalar::all(0);
        int loDiff = 30;
        int upDiff = 30;
        int connectivity = 4;
        int newMaskVal = 255;
        int NumSeeds = 10;
        cv::Rect ccomp;
        int flags = connectivity + (newMaskVal << 8 ) +  CV_FLOODFILL_FIXED_RANGE + CV_FLOODFILL_MASK_ONLY;
        for(int j=0; j<NumSeeds; j++){
            cv::Point seed;
            seed.x=rects[i].center.x+rand()%(int)minSize-(minSize/2);
            seed.y=rects[i].center.y+rand()%(int)minSize-(minSize/2);
            circle(result, seed, 1, Scalar(0,255,255), -1);
            int area = cv::floodFill(input, mask, seed, Scalar(255,0,0), &ccomp,

Scalar(loDiff, loDiff, loDiff), Scalar(upDiff, upDiff, upDiff), flags);
            printf("%d",area);
        }

some suggestions?

click to hide/show revision 2
retagged

updated 2014-03-20 16:29:19 -0600

berak gravatar image

ANPR Algorithm example using OpenCV

Hi all,

I followed this example/tutorial about ANPR algorithm using OpenCV.

I downloaded c++ example code and I ported this code on iOS app.

Using some example photos, this code work well.

Now, I would to use the iPhone camera to take the photo to pass to the ANPR algorithm but oft I obtain an error (so also a crash). The error is this:

int area = floodFill(input, mask, seed, Scalar(255,0,0), &ccomp, Scalar(loDiff, loDiff, loDiff), Scalar(upDiff, upDiff, upDiff), flags); OpenCV Error: Unsupported format or combination of formats () in cvFloodFill, file /src/floodfill.cpp, line 621

floodFill function is used in this context:

Mat mask;
        mask.create(input.rows + 2, input.cols + 2, CV_8UC1);
        mask= Scalar::all(0);
        int loDiff = 30;
        int upDiff = 30;
        int connectivity = 4;
        int newMaskVal = 255;
        int NumSeeds = 10;
        cv::Rect ccomp;
        int flags = connectivity + (newMaskVal << 8 ) +  CV_FLOODFILL_FIXED_RANGE + CV_FLOODFILL_MASK_ONLY;
        for(int j=0; j<NumSeeds; j++){
            cv::Point seed;
            seed.x=rects[i].center.x+rand()%(int)minSize-(minSize/2);
            seed.y=rects[i].center.y+rand()%(int)minSize-(minSize/2);
            circle(result, seed, 1, Scalar(0,255,255), -1);
            int area = cv::floodFill(input, mask, seed, Scalar(255,0,0), &ccomp,

Scalar(loDiff, loDiff, loDiff), Scalar(upDiff, upDiff, upDiff), flags);
            printf("%d",area);
        }

some suggestions?

ANPR Algorithm example using OpenCV

Hi all,

I followed this example/tutorial about ANPR algorithm using OpenCV.

I downloaded c++ example code and I ported this code on iOS app.

Using some example photos, this code work well.

Now, I would to use the iPhone camera to take the photo to pass to the ANPR algorithm but oft I obtain an error (so also a crash). The error is this:

int area = floodFill(input, mask, seed, Scalar(255,0,0), &ccomp, Scalar(loDiff, loDiff, loDiff), Scalar(upDiff, upDiff, upDiff), flags); flags);

OpenCV Error: Unsupported format or combination of formats () in cvFloodFill, file /src/floodfill.cpp, line 621 621

floodFill function is used in this context:

Mat mask;
        mask.create(input.rows + 2, input.cols + 2, CV_8UC1);
        mask= Scalar::all(0);
        int loDiff = 30;
        int upDiff = 30;
        int connectivity = 4;
        int newMaskVal = 255;
        int NumSeeds = 10;
        cv::Rect ccomp;
        int flags = connectivity + (newMaskVal << 8 ) +  CV_FLOODFILL_FIXED_RANGE + CV_FLOODFILL_MASK_ONLY;
        for(int j=0; j<NumSeeds; j++){
            cv::Point seed;
            seed.x=rects[i].center.x+rand()%(int)minSize-(minSize/2);
            seed.y=rects[i].center.y+rand()%(int)minSize-(minSize/2);
            circle(result, seed, 1, Scalar(0,255,255), -1);
            int area = cv::floodFill(input, mask, seed, Scalar(255,0,0), &ccomp,

Scalar(loDiff, loDiff, loDiff), Scalar(upDiff, upDiff, upDiff), flags);
            printf("%d",area);
        }

some suggestions?