に等価変換:私は「houghtfにハフ」を変更することにより、OCTAVEで同じことを実現しようとしているときにハフは、下のMATLABで</em>を変換し、私は<em>ハフのコードを添付したオクターブ
%Hough Transform to find lines
%Load an Image and Convert to Grayscale to apply canny Filter
im = imread('lines.jpg');
im_gray = rgb2gray(im);
im_edge = edge(im_gray, 'canny');
figure, imshow(im), title('Original Image');
figure, imshow(im_gray), title('Grayscale Image');
figure, imshow(im_edge), title('Canny Filter Edge');
%Apply Hough Transform to Find the Candidate Lines
[accum theta rho] = hough(im_edge);
figure, imagesc(accum, 'xData', theta, 'ydata', rho), title('Hough Accumulator');
peaks = houghpeaks(accum, 100, 'Threshold', ceil(0.6 * max(accum(:))),'NHoodSize', [5,5]);
size(peaks);
%Finding the line segments in the image
line_segs = houghlines(edges, theta, rows, peaks, 'FillGap', 50,'MinLength', 100);
%Plotting
figure, imshow(im), title('Line Segments');
hold on;
for k=1:length(line_segs)
endpoints = [line_segs(k).point1; line_segs(k).point2];
plot(endpoints(:,1), endpoints(:,2), 'LineWidth', 2, 'Color','green');
end
hold off;
、次のように 'immaximasにhoughpeaks'と'hough_lineにhoughlines':
%Hough Transform to find lines
pkg load image;
%Load an Image and Convert to Grayscale to apply canny Filter
im = imread('lines.jpg');
im_gray = rgb2gray(im);
im_edge = edge(im_gray, 'canny');
figure, imshow(im), title('Original Image');
figure, imshow(im_gray), title('Grayscale Image');
figure, imshow(im_edge), title('Canny Filter Edge');
%Apply Hough Transform to Find the Candidate Lines
[accum theta rho] = houghtf(im_edge); %In Octave and 'hough' in MATLAB
figure, imagesc(accum, 'xData', theta, 'ydata', rho), title('Hough Accumulator');
peaks = immaximas(accum, 100, 'Threshold', ceil(0.6 * max(accum(:))),'NHoodSize', [5,5]);
size(peaks);
%Finding the line segments in the image
line_segs = hough_line(edges, theta, rows, peaks, 'FillGap', 50, 'MinLength', 100);
%Plotting
figure, imshow(im), title('Line Segments');
hold on;
for k=1:length(line_segs)
endpoints = [line_segs(k).point1; line_segs(k).point2];
plot(endpoints(:,1), endpoints(:,2), 'LineWidth', 2, 'Color', 'green');
end
hold off;
それを実行しながら私は次のエラーを取得する: error: element number 3 undefined in return list
error: called from
HoughTransformLines at line 14 column 18
私は「ロー」は未定義であるというエラーを取得しています。 私はMATLABとOctaveについて全く新しいです。誰でもオハイオ州でハフ変換を実装するのを助けてくれますか?
これは、アキュムレータをプロットする方法を示しています。 しかし、私は15行目から「ロー」を削除する必要がありました: '[ACCUM角度θ= houghtf(im_edge);' しかし、まだこのエラー取得: 'エラー:immaximas:3番目の入力引数は、スカラーかでなければなりません空行列 エラー: から呼び出されるimmaximas行76列5 HoughTransformLines行18列7' – Ranit