• 大小: 2.39MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-17
  • 语言: Matlab
  • 标签: 未分类  

资源简介

matlab开发-交通警告标志识别标签代码。交通警示标志识别Matlab代码使用Matlab演示,来自Matlab 7.5的视频处理C

资源截图

代码片段和文件信息

function x=blobAnalysis(a)
%a=imread(‘stoproad.jpg‘);
x=a;
a(::1) = medfilt2(a(::1) [3 3]);
a(::2) = medfilt2(a(::2) [3 3]);
a(::3) = medfilt2(a(::3) [3 3]);
[r c d]=size(a);
check=1;
i1=0;j1=0;
i2=0;j2=0;
%for k=1:1;
    for i=1:r
        for j=1:c
            
            if(a(ij1)>125&&a(ij2)<90&&a(ij3)<90)
                if(check)
                i1=i;j1=j;
                check=0;
                else
                    i2=i;j2=j;
                end
                           
            end
            
            
        end
    end
%end


i1=i1-2;
if(i1<1)
    i1=1;
end
i2=i2+2;
if(i2>r)
    i2=r;
end

if(c>500)
    
j1=j1-40;
else
    if(r<150)
        j1=j1-10;
    else
    j1=j1-30;
    end
end
if(j1<1)
    j1=1;
end
j2=j2+20;
if(j2>c)
    j2=c;
end
i2-i1;

yieldtag=imread(‘yieldtag1.jpg‘);
stptag=imread(‘stoptag1.jpg‘);
[r1 c1 d1]=size(stptag);
z=a(i1:i2j1:j21:3);
%z=a(i1-10:i2+10j1-130:j2+701:3);
% figure(1)
% subplot(311)
% imshow(a);
% subplot(312)
% imshow(z);
z=rgb2gray(z);
z=im2double(z);
z=im2bw(z0.5);
%z=bilinear(z100100);
[row col]=size(z);
if(row~=0 && col~=0)
z=imresize(z [18 18] ‘nearest‘);
load vipwarningsigns_templates.mat;
for k=1:9
temp=template_recognition(::k);
s(k)=corr2(tempz);
end
mx=max(s);
ind=1;
for i=1:9
    if(s(i)==mx)
        ind=i;
    end
end
if(isnan(s)==0)
   if(i2-i1>20)
    if(mx>0.15)
        for l1=i1:i2
            a(l1j11)=255;
            a(l1j12)=255;
            a(l1j13)=0;
            
            a(l1j21)=255;
            a(l1j22)=255;
            a(l1j23)=0;
        end
        
        for l2=j1:j2
            a(i1l21)=255;
            a(i1l22)=255;
            a(i1l23)=0;
            
            a(i2l21)=255;
            a(i2l22)=255;
            a(i2l23)=0;
        end
        if(r<150)
            
       %if(ind==7||ind==8||ind==9)
        scalex=i2+r1-1;
        scaley=j1+c1-1;
       % size(a(i2:scalexscaley:j1));
        a(i2:scalexj1:scaley:)=yieldtag;
      % end
        else
       %if(ind==1||ind==2||ind==3)
        scalex=i2+r1-1;
        scaley=j1-c1+1;
       % size(a(i2:scalexscaley:j1));
        a(i2:scalexscaley:j1:)=stptag;
     %  end
        end


      
    end
   end
end
end
x=a;
%figure(2)imshow(a);



 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        2430  2013-01-06 00:17  traffic warning\blobAnalysis.m
     文件         374  2013-01-06 05:49  traffic warning\main.asv
     文件         426  2013-01-06 07:10  traffic warning\main.m
     文件     2036658  2013-01-03 03:58  traffic warning\stoprd.avi
     文件      223578  2012-12-29 20:12  traffic warning\stoproad.jpg
     文件         806  2013-01-03 04:21  traffic warning\stoptag1.jpg
     文件      369810  2013-01-03 00:51  traffic warning\Yield.avi
     文件         804  2013-01-03 05:03  traffic warning\yieldtag1.jpg
     文件        1514  2014-02-12 14:19  license.txt

评论

共有 条评论