Effacer les filtres
Effacer les filtres

how to rotate/skew binary image by orientation angle

1 vue (au cours des 30 derniers jours)
Gytis Raudonius
Gytis Raudonius le 4 Nov 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.

Réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by