3Answers
Matlab uses five conventional operators to perform edge detection on an image, which is the best
Asked by: Ward 230 views IT
Matlab uses five conventional operators to perform edge detection on an image, which is the best
Welcome Guest.
Asked by: Ward 230 views IT
Matlab uses five conventional operators to perform edge detection on an image, which is the best
+8Votes
close all
clear all
I=imread(‘tig.jpg’); %Read Image
I1=im2double (I); % turns the color map sequence into double precision
I2=rgb2gray(I1); % turns the color map into a gray map
[thr,  ;sorh, keepapp]=ddencmp(‘den’,’wv’,I2);
I3=wdencmp(‘gbl’,I2,’sym4′,2,thr,sorh,keepapp) ; %Wave Denoising
I4=medfilt2(I3,[9 9]); % Median Filtering
I5=imresize(I4,0.2,’bicubic ‘); % image size
BW1=edge(I5,’sobel’); %sobel image edge extraction
BW2=edge(I5,’roberts’) ; %robertsImage Edge Extraction
BW3=edge(I5,’prewitt’); %prewittImage Edge Extraction
BW4=edge(I5,’log’) ; %log image edge extraction
BW5=edge(I5,’canny’); %canny image edge extraction
h=fspecial(‘gaussian’,5) ; %Gaussian filtering
BW6=edge(I5,’zerocross’,[ ],h); %zerocross image edge extraction
figure;
subplot(1,3,1); % is divided into three lines, the first picture
imshow(I2); %Drawing
figure;
subplot(1,3,1);
imshow(BW1);
title(‘Sobel operator’);
subplot(1 ,3,2);
imshow(BW2);
title(‘Roberts operator’);
subplot(1,3,3);
imshow(BW3);
title(‘Prewitt operator’);
+5Votes
lose all< /p>
clear all
I=imread(‘tig.jpg’); %read images
I1=im2double(I); % Turn a colormap sequence into double-precision
I2=rgb2gray(I1); %Turn a colormap into a gray one
[thr, sorh, keepapp] =ddencmp(‘den’,’wv’,I2);
I3=wdencmp(‘gbl’,I2,’sym4′,2,thr,sorh,keepapp); %Wavelet denoising
I4=medfilt2(I3,[9 9]); % Median Filter
I5=imresize(I4,0.2,’bicubic’); %Image Size
BW1=edge(I5,’sobel’); %sobel image edge extraction
BW2=edge(I5,’roberts’); %roberts image edge Extraction
BW3=edge(I5,’prewitt’); %prewitt image edge extraction
BW4=edge(I5,’log’); %log image edge Extract
BW5=edge(I5,’canny’); %canny image edge extraction
h=fspecial(‘gaussian’,5);  ;% Gaussian filtering
BW6=edge(I5,’zerocross’,[ ],h); %zerocross image edge extraction
figure;
< p>subplot(1,3,1); % is divided into three lines, the first picture
imshow(I2); %Drawing
figure ;
subplot(1,3,1);
imshow(BW1);
title(‘Sobel operator’);
< p>subplot(1,3,2);
imshow(BW2);
title(‘Roberts operator’);
subplot(1, 3,3);
imshow(BW3);
title(‘Prewitt operator’);
+7Votes
im =imread(‘h1.jpg’);I=rgb2gray(im); bw1=edge(I,’sobel’); bw2=edge(I,’roberts’); bw3=edge(I,’canny’ ); bw4=edge(I,’prewitt’); figure(2),subplot(2,2,1);imshow(bw4);title(‘prewitt operator renderings’); subplot (2,2,2);imshow(bw1);title(‘sobel operator renderings’); subplot(2,2,3);imshow(bw2);title(‘roberts operator renderings’) ; subplot(2,2,4);imshow(bw3);title(‘canny operator renderings’);