Edge Linking and Boundary Detection, Hough Transform with example in DIP & implementation in MATLAB

Study with Dr. Dafda
Study with Dr. Dafda
19.7 هزار بار بازدید - 2 سال پیش - Video lecture series on Digital
Video lecture series on Digital Image Processing, Lecture: 50, Edge Linking and Boundary Detection, Hough Transform and its implementation in MATLAB What is edge linking? Which are different edge linking approaches? What is Hough transform? Explain Hough transform with example. Explain steps in Hough transform. Link to download ppts/lecture notes: drive.google.com/drive/folders/1AtR1eq6ZvQf-5vjXEM… #DIP #DIPwithMATLAB #DigitalImageProcessingUsingMATLAB #DigitalImageProcessing #StudywithDrDafda MATLAB codes used in the video are given below: % MATLAB code for Hough Transform close all; clear all; clc; I = imread('circuit.tif'); subplot(2,2,1);imshow(I);title('Original Image') rotI = imrotate(I,33,'crop');% rotate and crop image for better understanding BW = edge(rotI,'canny'); % edge finding using Canny detector [H,theta,rho] = hough(BW); % Computing the Hough transform % Display the transform subplot(2,2,2); imshow(H,[],'XData',theta,'YData',rho,... 'InitialMagnification','fit'); xlabel('\theta'), ylabel('\rho'); axis on, axis normal, hold on; title('The Hough Transform') % Find the peaks in the Hough transform matrix, H P = houghpeaks(H,5,'threshold',ceil(0.3*max(H(:)))); % Plot the peaks subplot(2,2,3); imshow(H,[],'XData',theta,'YData',rho,... 'InitialMagnification','fit'); xlabel('\theta'), ylabel('\rho'); axis on, axis normal, hold on; x = theta(P(:,2)); y = rho(P(:,1)); plot(x,y,'s','color','white'); title('The peaks in Transform') % Find lines in the image lines = houghlines(BW,theta,rho,P,'FillGap',5,'MinLength',7); % Create a plot that superimposes the lines on the original image subplot(2,2,4); imshow(rotI), hold on max_len = 0; for k = 1:length(lines) xy = [lines(k).point1; lines(k).point2]; plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green'); % Plot beginnings and ends of lines plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow'); plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red'); % Determine the endpoints of the longest line segment len = norm(lines(k).point1 - lines(k).point2); if ( len (greater than) max_len) max_len = len; xy_long = xy; end end % highlight the longest line segment plot(xy_long(:,1),xy_long(:,2),'LineWidth',2,'Color','cyan'); title('Image with highlighted lines')
2 سال پیش در تاریخ 1401/09/05 منتشر شده است.
19,758 بـار بازدید شده
... بیشتر