We have been working on edge detectors for last three lessons. In this lesson, we are going to combine the last three lessons and apply the Roberts, Prewitt and Sobel edge detector on live webcam video feed to extract the edges.
Here is the code used in this lesson:
clear all
cam = webcam();
cam.Resolution = '320x240';
h = figure;
while ishandle(h)
I = snapshot(cam);
G = rgb2gray(I);
S = edge(G, 'sobel');
R = edge(G, 'roberts');
P = edge(G, 'prewitt');
subplot(2,2,1); imshow(I); title('Original Image');
subplot(2,2,2); imshow(S); title('Sobel Edges');
subplot(2,2,3); imshow(R); title('Roberts Edges');
subplot(2,2,4); imshow(P); title('Prewitt Edges');
drawnow
end
You are free to copy, modify and share this code. And if you think my lessons are helpful, please hit the like button, share it with your friends and subscribe to the channel.
Негізгі бет Lesson 37: Edge Detection in Videos
Пікірлер