if nargin==3
thresh = 0.33; % One third of the perimeter
delta = 12; % Each element in (x y r) may deviate approx. 4 pixels
edgeim = edge(im, 'canny', [0.15 0.2]);
end

if nargin==4
edgeim = edge(im, 'canny', [0.15 0.2]);
delta = 12;
end

if (nargin==5)
edgeim = edge(im, 'canny', canny_th);
delta = 12;
end

if (nargin==6)
edgeim = edge(im, 'canny', canny_th,sigma);
delta=12;
end
if (nargin == 7)
edgeim = edge(im, 'canny', canny_th,sigma);
end
end

Hi, nice function. I've made some changes that may be interesting. It wold be nice to change the threshold and sigma value for canny edge detection, so, I added a few lines to improve this, changing the location of the definition of the edgeimage

if nargin==3

thresh = 0.33; % One third of the perimeter
delta = 12; % Each element in (x y r) may deviate approx. 4 pixels
edgeim = edge(im, 'canny', [0.15 0.2]);

elseif nargin==4

if ((max(size(canny_th) == 2)) || (max(size(canny_th) == 1)))
if max(size(canny_th) == 2)
edgeim = edge(im, 'canny', [canny_th(1) canny_th(2)]);
end
if max(size(canny_th) == 1)
edgeim = edge(im, 'canny', canny_th(1));
end
end
delta = 12;

else (nargin==5)

if ((max(size(canny_th) == 2)) || (max(size(canny_th) == 1)))
if (max(size(canny_th) == 2))
edgeim = edge(im, 'canny', [canny_th(1) canny_th(2)],sigma);
end
if (max(size(canny_th) == 1))
edgeim = edge(im, 'canny', canny_th(1),sigma);
end
end
delta = 12;
end

Image Analyst, thanks for your comments. I like your suggestion about accepting the output of bwboundaries as the 2nd input argument. I don't really understand your comment about bwperim, though.

Comment only

13 Oct 2013

Image overlay
Overlay a binary mask onto an image using a specified color

bwperim is not the only way to create outlines. It would be nice if imoverlay were smart enough to see if the input was a binary image, or a cell array that is the output of bwboundaries. A lot of times we threshold and then call bwboundaries. It would be a nice enhancement if it could take the output of bwboundaries as the location of the outlines to draw.

Comment only