Hough Transform source code explanation

2 次查看(过去 30 天)
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

采纳的回答

Walter Roberson
Walter Roberson 2017-4-22
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 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by