Ask Your Question

disk shaped structuring element using cvcreatestructruingelementEx

asked 2013-06-22 09:10:33 -0500

Muhammet Ali gravatar image

updated 2020-11-15 02:06:57 -0500

Hi all I want to create a disk shaped SE similar to this in Matlab


but How can I decide to value of anchor points coordinates of SE.

This is 4 radius,sel in matlab : image description

how this Se is made using cvcreateStructuringElementEx.Thanks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-06-22 11:24:51 -0500

Notas gravatar image

Please, let's stick to the new interface. Then it's just a simple Mat. Create your mat like this

Mat mat = Mat::ones(7, 7, CV_8U);

Then use<uchar>(y, x) = 0

to set the 0 values at the 12 positions in the matrix. The anchor point is of course the middle 3,3 (if you don't want it another position, which I doubt). You can also set it to -1,-1 then the middle is internally computed. Use morphologyEx for the morphological operation(s).

edit flag offensive delete link more

Question Tools


Asked: 2013-06-22 09:10:33 -0500

Seen: 1,615 times

Last updated: Jun 22 '13