canny - function [sFinal,thresh] = canny(img, mLow, mHigh,...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
% Canny edge detector %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% % function [sFinal, thresh] =canny(img, mLow, mHigh, sig) % Applies the canny edge detection algo to the given image % img : the given image (matrix) in color or B/W % mLow : the threshold is set adaptively: low_threshold = mLow* mean_intensity(im_gradient) % mHigh: the threshol is set adaptively: high_threshold= mHigh*low_threshold % sig : the value of sigma for the derivative of gaussian operator % % The default values for (sig, mLow, mHigh) are (1, 0.5, 2.5) % The function displays the image and also returns: % sFinal : the final (B/W) image with edges % thresh : =[lowT, highT] the actual low and high thresholds used % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% % CS223b HW# 1a: Canny Edge Detector % Rohit Singh & Mitul Saha: {rohitsi, mitul}@stanford.edu % % Good parameters: % elephant.jpg : canny(eim, 1.5, 2.6, 1) % macbeth.jpg : canny(mim, .1, 9, 2); recognises 21 of 24 squares % hecface.jpg : canny(him, .6, 3, 1); or canny(him, .4,3.5,1); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% if (nargin < 1) error(' Need a NxNx3 or NxN image matrix'); elseif (nargin ==1) mLow = 0.5; mHigh = 2.5; sig = 1; elseif (nargin == 2) mHigh = 2.5; sig = 1; elseif (nargin == 3) sig = 1; end %sig = 1; %mLow = 0.5; %mHigh = 2.5; %img = imread('macbeth.jpg'); %img = imread('elephant.jpg'); %img = imread('hecface.jpg');
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/06/2010 for the course CSE 527 taught by Professor Ab during the Fall '09 term at Cornell University (Engineering School).

Page1 / 5

canny - function [sFinal,thresh] = canny(img, mLow, mHigh,...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online