MCPcopy Create free account
hub / github.com/creatale/node-dv / checkMask

Function checkMask

deps/opencv/modules/imgproc/src/grabcut.cpp:322–340  ·  view source on GitHub ↗

Check size, type and element values of mask matrix. */

Source from the content-addressed store, hash-verified

320 Check size, type and element values of mask matrix.
321 */
322static void checkMask( const Mat& img, const Mat& mask )
323{
324 if( mask.empty() )
325 CV_Error( CV_StsBadArg, "mask is empty" );
326 if( mask.type() != CV_8UC1 )
327 CV_Error( CV_StsBadArg, "mask must have CV_8UC1 type" );
328 if( mask.cols != img.cols || mask.rows != img.rows )
329 CV_Error( CV_StsBadArg, "mask must have as many rows and cols as img" );
330 for( int y = 0; y < mask.rows; y++ )
331 {
332 for( int x = 0; x < mask.cols; x++ )
333 {
334 uchar val = mask.at<uchar>(y,x);
335 if( val!=GC_BGD && val!=GC_FGD && val!=GC_PR_BGD && val!=GC_PR_FGD )
336 CV_Error( CV_StsBadArg, "mask element value must be equel"
337 "GC_BGD or GC_FGD or GC_PR_BGD or GC_PR_FGD" );
338 }
339 }
340}
341
342/*
343 Initialize mask using rectangular.

Callers 1

grabCutMethod · 0.85

Calls 2

emptyMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected