Wednesday 15 September 2010

c++ - Disk Structuring Element opencv vs Matlab -


I want to create a disk size structural element on OpenCv. I need my SE

  sel = strel ('disk', 5);   

I want to use

  cvstructuringElementEx (cols, rows, anchor_x, anchor_y, size, * value) to do this;   

What should I do to get this and what is the value of anchor_x and anchor_y ? According to

, you can try:

  cv:   

: Mat sel = cv :: getStructuringElement (MORPH_ELLIPSE, CV :: size (9));

This gave me the following structure element:

  0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 0 0   

When I was in MATLAB:

  & gt; & Gt; Milan (Stale ('Disk', 5)) ans = 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0   

Not quite right, but close enough :)

No comments:

Post a Comment