deriche edge detector

10 views (last 30 days)
ouss ann
ouss ann on 18 May 2011
Edited: Neol Solanki on 17 Jul 2020
I am looking for a MATLAB code (M file) that can perform Canny-Deriche edge detection on a medical image (Ultrasound).
thanks

Answers (2)

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

Neol Solanki
Neol Solanki on 16 Jul 2020
Edited: Neol Solanki on 17 Jul 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.

Products

Community Treasure Hunt

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

Start Hunting!