File Exchange

## Three dimensional implementation of the Canny edge detection

version 1.0 (2.35 KB) by

Can be used to detected surfaces from a 3D volume.

Updated

Current implementation is not optimized.
Process a small portion of 3D volume at a time and combine them at the end to reduce memory consumption.

Akshay Gore

### Akshay Gore (view profile)

plz give a example to run program
size of gaussian filter?
final = canny3D(lena, filsize,0.5, 10,1);

boyexex

### boyexex (view profile)

im: 3D matrix of the image stack; type: double
filsize: size of gaussian filter; type: unsigned integer
sigma: standard deviation of the gaussian filter; type: double
th_up: upper threshold for the hysteresis process; type: double
th_low: lower threshold for the hysteresis process; type: double

Hope this help.

Can you go into more detail on how it works bc I am getting a "Not enough input arguments" error at line 16

boyexex

### boyexex (view profile)

Re CH:
line 21 of the nonmax_sup.m file should be:
imtemp = interp3(x,y,z,imfil_mag,xi,yi,zi);
rather than":
imtemp = interp3(imfil_mag,xi,yi,zi);

In addition, the input volume data of the canny3D function has to be a 3D array.

JR King

### JR King (view profile)

Same error as CH for me.

Chuck Hatt

### Chuck Hatt (view profile)

Didn't work for me, but looks promising

edgevol = canny3D(double(vol),5,2,.3,.1);
??? Subscript indices must either be real positive integers or logicals.

Error in ==> interp3>linear at 374
F = (( arg4(ndx).*(1-t) + arg4(ndx+1).*t ).*(1-s) + ...

Error in ==> interp3 at 223
vi = linear(x,y,z,v,xi,yi,zi,ExtrapVal);

Error in ==> nonmax_sup at 21
imtemp = interp3(imfil_mag,xi,yi,zi);

Error in ==> canny3D at 28
im_sub = nonmax_sup(imfil_x,imfil_y,imfil_z,th_up, th_low);

boyexex

### boyexex (view profile)

parameters of this function is simple.

im_out = canny3D(im_in, size_of_gaussian_filter, SD_of_gaussian_filter, upper_threshold, lower_threshold)

im_out is a logical 3D array of surfaces; 1 for surface, 0 otherwise.

For the definition of upper_threshold and lower_threshold please check the original paper on Canny edge detection by John Canny.

##### MATLAB Release
MATLAB 7.8 (R2009a)