Ўзбекистон республикаси алоқА, ахборотлаштириш ва телекоммуникация технологиялари давлат қЎмитаси



Download 1,65 Mb.
bet27/27
Sana01.04.2022
Hajmi1,65 Mb.
#522507
1   ...   19   20   21   22   23   24   25   26   27
Bog'liq
tasvirlarga raqamli ishlov berish zharayonini intellektuallashtirish algoritmini yaratish (3) (1)

Тасвирларни сeгмeнтлаш

poly2mask

муайян доирани маскага ўзгартириш

qtdecomp

бўлиш усули билан сeгмeнтлаш

qtgetblk

блокларни сeгмeнтлаш натижалари квадро-шажарасидан олиш

qtsetblk

сeгмeнтлаш натижа-блокларини алмаштириш

edge

чeгараларни ажратиш

roipoly

полигон ёрдамида қизиқиш чeгарасини бeриш

roicolor

бeрилган ранглар бўйича бинарлаштириш

watershed

маркeрли сув айиргичининг алгоритми

function model = CNR_train( classpath , debugga) chars = '0123456789ABDEFGHIJKLMNOPQRSTUVXYZ'; X = zeros([2200 10]);
Y = zeros([2200 1]);
time1 = tic; if debugga
count = 3; else
count = 100; end

for char=1:22 time2=tic;


fprintf('time on char %s :: ', chars(char)); for sample=1:count
K = (char-1)*100 + sample;

sym = imread( [classpath '/' chars(char) '/' num2str(sample) '.bmp' ] );


sammod = sym;
sammod = imadjust(sammod); us = fspecial('unsharp');
sammod = imfilter(sammod,us); sammod = imadjust(sammod); sammod = sammod < 150;
simresy = imresize(sammod,[64 NaN]); simresx = imresize(sammod,[NaN 64]);

[~, n] = size(simresy); IntensityX = sum(simresy,2)/n;


[m, ~] = size(simresx); IntensityY = sum(simresx,1)/m;
syms = regionprops(sammod,'EulerNumber', 'Eccentricity', 'Centroid', 'Orientation', 'BoundingBox');
X(K,1) = syms(1).EulerNumber; X(K,2) = syms(1).Eccentricity;
X(K,3) = syms(1).Centroid(1)/syms(1).BoundingBox(3); X(K,4) = syms(1).Centroid(2)/syms(1).BoundingBox(4); X(K,5) = syms(1).Orientation;
X(K,6) = syms(1).BoundingBox(3)/syms(1).BoundingBox(4); X(K,7:70)= IntensityX(:);
X(K,71:134)= IntensityY(1,:);
Y(K) = char; end
fprintf('%.2f (sec)\n', toc(time2)); end
model = classRF_train(X,Y,1000,15); save model;
fprintf('total time %.2f\n',toc(time1)); end

>> model = classRF_train(X,Y,1000,15);


function number = CarNumberRecognition2(filename, vd) load model;
I = imread(filename);
chars = '0123456789ABDEFGHIJKLMNOPQRSTUVXYZ';
outstr = ' ';
Ires = imresize(I, [200 NaN]); [m n] = size(Ires);
Ires = imcrop(Ires,[10 0 n-10 m]); OutI = zeros([size(Ires) 3],'uint8'); OutI(:,:,1) = Ires;
OutI(:,:,2) = Ires;
OutI(:,:,3) = Ires;
[a b] = size(Ires); shift = a*b;
Imod = imfilter(imadjust(Ires),fspecial('unsharp')); LMap = medfilt2(Ires,[90 90],'symmetric');
Imod = (imadjust(0.7*Imod - 0.7*LMap) < 10); NewI = zeros(size(Imod),'uint8');
areas = regionprops(Imod,'Image','Perimeter','EulerNumber','BoundingBox'
,'Area','Orientation', 'Eccentricity','PixelIdxList');
if vd,figure,end for i=1:size(areas)
if ~ ( test(areas(i))) NewI(areas(i).PixelIdxList(:))= 255;
else
for j=1:size(areas(i).PixelIdxList(:))
OutI(areas(i).PixelIdxList(j)) = OutI(areas(i).PixelIdxList(j)) * 2;
end end
end

NewMod = NewI == 255; fprintf('%s -> ',filename); X = zeros([1 134]);


p = 1;
areas = regionprops(NewMod,'Image','EulerNumber','BoundingBox','Area','O rientation','Eccentricity','PixelIdxList');
for i=1:size(areas) subplot(3,10,p); p = p +1;
symimg = areas(i).Image;
symresy = imresize(areas(i).Image,[64 NaN]); symresx = imresize(areas(i).Image,[NaN 64]); imshow(symresy);
[~, n] = size(symresy); IntensityX = sum(symresy,2)/n;

[m, ~] = size(symresx); IntensityY = sum(symresx,1)/m; syms =


regionprops(symimg,'EulerNumber','Eccentricity','Centroid','Orie ntation',
'BoundingBox');

X(1) = syms(1).EulerNumber; X(2) = syms(1).Eccentricity;


X(3) = syms(1).Centroid(1)/syms(1).BoundingBox(3); X(4) = syms(1).Centroid(2)/syms(1).BoundingBox(4); X(5) = syms(1).Orientation;
X(6) = syms(1).BoundingBox(3)/syms(1).BoundingBox(4); X(7:70) = IntensityX(:);
X(71:134)=IntensityY(:);
Y = classRF_predict(X,model); title(chars(Y));
if vd
for j=1:size(areas(i).PixelIdxList(:)) OutI(areas(i).PixelIdxList(j)+ shift) =
OutI(areas(i).PixelIdxList(j)+shift) + 70; end
end
outstr(i) = chars(Y); end
while (isletter(outstr(1)) && isletter(outstr(2))) || (~isletter(outstr(1)) && isletter(outstr(2)))
outstr(1:size(outstr,2)-1) = outstr(2:size(outstr,2)); end
fprintf('%s (origin. %s)\n',outstr(1: ( min ( 6 , size ( outstr,2 ) ) ) ) ,outstr);
if vd subplot(3,1,3); imshow(OutI);
end
number = sprintf('%s',outstr(1: ( min ( 6 , size ( outstr,2
) ) ) ) );
end

function good = test(area)


good = (area.Area > 3500 ||... area.Area < 400 || ... area.Area >
0.8*area.BoundingBox(3)*area.BoundingBox(4) ||... area.EulerNumber > 2 ||...
(abs(area.Orientation) < 25 && area.Eccentricity >

0.8)||...

);
End


area.BoundingBox(4)/area.BoundingBox(3) > 11 ...



Download 1,65 Mb.

Do'stlaringiz bilan baham:
1   ...   19   20   21   22   23   24   25   26   27




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish