Hough Transform source code explanation
4 views (last 30 days)
Show older comments
Ba Ba Black Sheep!
on 22 Apr 2017
Answered: Walter Roberson
on 22 Apr 2017
I couldn't understand the following code's for loop.
What is the purpose of the for loop here?
Why is for iterating from 7 to 7?
And, why is num_peak = 3?
clc
close all
clear all
imageCaption = sprintf('scratchedImage.jpg');
inputOriginalImage = imread(imageCaption);
inputOriginalImageGrayscale = rgb2gray(inputOriginalImage);
completelyPreprocessedImage = Preprocessing( inputOriginalImage );
N = 12;
bandpassFilteredImage = BandpassFiltering(completelyPreprocessedImage, N);
[ROWS, COLS, k] = size(bandpassFilteredImage);
homomorphicFilteredImage = HomomorphicFiltering(bandpassFilteredImage, N);
num_peak=3;
length_line=[];
for n=7:7
inputImageForHaughtTransform = bwareaopen( homomorphicFilteredImage(:,:,n),20);
[houghtTransformMatrix, theta, rho] = hough(inputImageForHaughtTransform);
imshow(houghtTransformMatrix,[],'XData',theta,
'YData',rho,'InitialMagnification','fit');
xlabel('\theta'), ylabel('\rho');
axis on, axis normal, hold on;
peaks = houghpeaks(houghtTransformMatrix,3,'threshold',
ceil(0.3*max(houghtTransformMatrix(:))));
x = theta(peaks(:,2));
y = rho(peaks(:,1));
plot(x,y,'s','color','white');
foundLinesInHoughOperation = houghlines(inputImageForHaughtTransform,
theta, rho, peaks,'FillGap',
5,'MinLength',7);
figure, imshow(completelyPreprocessedImage), hold on
MarkLines(foundLinesInHoughOperation, COLS, x, y);
end
0 Comments
Accepted Answer
Walter Roberson
on 22 Apr 2017
We do not know. The routines Preprocessing(), BandpassFiltering(), and HomomorphicFiltering() are not Mathworks routines, and they do not appear to be anywhere in a File Exchange contribution either. We do not know what they do.
0 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!