deriche edge detector

4 visualizzazioni (ultimi 30 giorni)
ouss ann
ouss ann il 18 Mag 2011
Modificato: Neol Solanki il 17 Lug 2020
I am looking for a MATLAB code (M file) that can perform Canny-Deriche edge detection on a medical image (Ultrasound).
thanks

Risposte (2)

Sean de Wolski
Sean de Wolski il 18 Mag 2011
Never heard of Canny-Deriche, but there's a Canny filter in:
doc edge

Neol Solanki
Neol Solanki il 16 Lug 2020
Modificato: Neol Solanki il 17 Lug 2020
Hello, there is no matlab function for performing this task. Canny-deriche algorithm differes from canny algorithm in intial steps. The nonmaxima step and hysteresis step are same in both algroithms.
Here is the code you can implement deriche algorithm:
alpha=1;
c=((1-exp(-alpha)).*(1-exp(-alpha)))/(exp(-alpha));
k=(((1-exp(-alpha)).*(1-exp(-alpha))).*(alpha).*(alpha))/(1-2.*alpha.*exp(-alpha)-exp(-2.*alpha));
[m,n]=meshgrid(-20:1:20,-20:1:20);
X=(-c).*(m).*exp(-(alpha).*(abs(m)+abs(n))).*k.*(alpha.*(abs(n)+1));
Y=(-c).*(n).*exp(-(alpha).*(abs(m)+abs(n))).*k.*(alpha.*(abs(m)+1));
X=X./(alpha.*alpha);
Y=Y./(alpha.*alpha);
In this code it is assumed that the value of omega is small enough, and simplified accordingly. For large value of omega use this code:
alpha=0.8;
omega=0.5;
c=(1-2.*exp(-alpha).*cos(omega)+exp(-2.*alpha))/(exp(-alpha).*(sin(omega)));
k=((1-2.*exp(-alpha).*cos(omega)+exp(-2.*alpha))*(alpha.*alpha+omega.*omega))/(2.*alpha*exp(-alpha).*sin(omega)+omega-omega.*exp(-2.*alpha));
[m,n]=meshgrid(-20:1:20,-20:1:20);
Xc=(-c).*exp(-alpha.*abs(m)).*(sin(omega)).*(m);
Xt=(k).*(alpha.*sin(omega).*abs(n)+(omega).*cos(omega).*abs(n))*(exp(-alpha.*abs(n)));
Yc=(-c).*exp(-alpha.*abs(n)).*(sin(omega)).*(n);
Yt=(k).*(alpha.*sin(omega).*abs(m)+(omega).*cos(omega).*abs(m))*(exp(-alpha.*abs(m)));
X=Xc.*Xt;
Y=Yc.*Yt;
X=X./(alpha.*alpha+omega.*omega);
Y=Y./(alpha.*alpha+omega.*omega);
After this step convolve the gray scale image with these two filters X and Y using conv2 function. After convolving, find magnitude and phase respectively, and give these images as input to nonmaxima filter and then do hysteresis. If you do not want to change the size of the deriche filter every time you change the values of alpha and omega, you can use IIR filter.

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by