Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

extract the matrix from strel matlab

Tags:

matlab

I am trying to use the strel function from matlab, and get its matrix value alone. When I define a strel object, as follows,

    SE = strel('disk',2);

I get the following

     SE

     SE =

       Flat STREL object containing 13 neighbors.

     Neighborhood:
       0     0     1     0     0
       0     1     1     1     0
       1     1     1     1     1
       0     1     1     1     0
       0     0     1     0     0

But when I try to use it as a matrix, am getting error. Is there a way where I can just extract the matrix part of this object? Please help me.

like image 412
Lakshmi Narayanan Avatar asked Jan 12 '23 12:01

Lakshmi Narayanan


1 Answers

Use the STREL object's getnhood() function:

SE.getnhood()

ans = 
       0     0     1     0     0
       0     1     1     1     0
       1     1     1     1     1
       0     1     1     1     0
       0     0     1     0     0
like image 97
Gordon Bean Avatar answered Jan 22 '23 19:01

Gordon Bean