how to rotate/skew binary image by orientation angle

1 visualización (últimos 30 días)
Gytis Raudonius
Gytis Raudonius el 4 de Nov. de 2015
Editada: Gytis Raudonius el 4 de Nov. de 2015
I work on anpr so i need to rotate number plate, so i think i need to know orientation angle. And then rotate or skew so how i can do this. Thans for answers.
warning off
img = imread('6.jpg');
img1 = rgb2gray(img);
imshow(img1);
level = graythresh(img1);
BW = im2bw(img1,level);
figure, imshow(BW);
BW1 = imclearborder(BW);
figure, imshow(BW1);
CC = bwconncomp(BW1, 8);
S = regionprops(CC, 'Area');
L = labelmatrix(CC);
P = 1500;
BW2 = ismember(L, find([S.Area] >= P));
figure, imshow(BW2);
st = regionprops(BW2, 'BoundingBox', 'Orientation' );
L = labelmatrix(CC);
for k = 1 : length(st)
thisBB = st(k).BoundingBox;
rectangle('Position', [thisBB(1),thisBB(2),thisBB(3),thisBB(4)],...
'EdgeColor','r','LineWidth',2 )
I = imcrop(BW2, thisBB);
figure, imshow(I);
I2 = imcrop(img, thisBB);
figure, imshow(I2)
end
so i think i have orientation angle but i dont know how to use it by rotate.

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by