Ask Your Question

Revision history [back]

Best way is to test

Mat mm=Mat::zeros(2,2,CV_8U);
Mat p=Mat::zeros(256,256,CV_8U),dst;
erode(p,dst,mm);

Best way is to test

Mat mm=Mat::zeros(2,2,CV_8U);
Mat p=Mat::zeros(256,256,CV_8U),dst;
erode(p,dst,mm);

Best way is to test

Mat mm=Mat::zeros(2,2,CV_8U);
mm=Mat::ones(2,2,CV_8U);
Mat p=Mat::zeros(256,256,CV_8U),dst;
erode(p,dst,mm);

Best way is to test

Mat mm=Mat::ones(2,2,CV_8U);
m2=Mat::ones(2,2,CV_8U);
Mat p=Mat::zeros(256,256,CV_8U),dst;
erode(p,dst,mm);
m3=Mat::ones(3,3,CV_8U);
Mat p=Mat::zeros(256,256,CV_8U),dst2,dst3,dst;
erode(img,dst2,m2);
erode(img,dst3,m3);
subtract(dst2,dst3,dst,Mat(),CV_16S);
float x = norm(dst);
cout<<"Difference between erode 2x2 and 3x3"<<x;

Best way is to test

Mat m2=Mat::ones(2,2,CV_8U);
Mat m3=Mat::ones(3,3,CV_8U);
Mat p=Mat::zeros(256,256,CV_8U),dst2,dst3,dst;
erode(img,dst2,m2);
erode(img,dst3,m3);
subtract(dst2,dst3,dst,Mat(),CV_16S);
float x = norm(dst);
cout<<"Difference between erode 2x2 and 3x3"<<x;

and for anchor (ksize = 2 or 3 in my example and anchor.x==-1) line 357 filterengine.hpp opencv 3.0

   if( anchor.x == -1 )
       anchor.x = ksize.width/2;
   if( anchor.y == -1 )
       anchor.y = ksize.height/2;

Best way is to test

m=imread("f:/lib/opencv/samples/data/fruits.jpg",CV_LOAD_IMAGE_GRAYSCALE);
Mat m2=Mat::ones(2,2,CV_8U);
Mat m3=Mat::ones(3,3,CV_8U);
Mat p=Mat::zeros(256,256,CV_8U),dst2,dst3,dst;
erode(img,dst2,m2);
erode(img,dst3,m3);
Matdst2,dst3,dst;
dilate(m,dst2,m2);
dilate(m,dst3,m3);
subtract(dst2,dst3,dst,Mat(),CV_16S);
float x = norm(dst);
cout<<"Difference between erode 2x2 and 3x3"<<x;
3x3 : "<<x;

the difference is 4337.25 and for anchor (ksize = 2 or 3 in my example and anchor.x==-1) line 357 filterengine.hpp opencv 3.0

   if( anchor.x == -1 )
       anchor.x = ksize.width/2;
   if( anchor.y == -1 )
       anchor.y = ksize.height/2;