1

バーコードを使用して画像を回転させて、角度がどこにあるかを判断し、水平になるように回転させるにはどうすればよいですか。使用Hough Transformしましたが、右に少ししか回転できません。

元の画像 回転した画像

rgb = imread('barcode10.jpg');
% Resize Image
rgb = imresize(rgb,0.33);
figure(),imshow(rgb);
% Convert from RGB to Gray
Igray = double(rgb2gray(rgb));
BW2 = edge(Igray,'canny');
figure(),imshow(BW2);
% Perform the Hough transform
[H, theta, rho] = hough(BW2);
 % Find the peak pt in the Hough transform
peak = houghpeaks(H);
 % Find the angle of the bars
barAngle = theta(peak(2));
J = imrotate(rgb,barAngle,'bilinear','crop');
figure(),imshow(J);
4

1 に答える 1

1

最初に線を検出する必要があります。ライン検出には、ハフ変換を使用できます。

于 2012-02-01T06:20:24.403 に答える