I=imread('C:\11.jpg')
[y,x,z]=size(I);
myI=double(I);
tic
Blue_y=zeros(y,1);
for i=1:y
for j=1:x
if((myI(i,j,1)<=30)&&((myI(i,j,2)<=62)&&(myI(i,j,2)>=51))&&((myI(i,j,3) <=142)&&(myI(i,j,3)>=119)))
Blue_y(i,1)= Blue_y(i,1)+1;
end
end
end
[temp MaxY]=max(Blue_y);
PY1=MaxY;
while ((Blue_y(PY1,1)>=5)&&(PY1>1))
PY1=PY1-1;
end
PY2=MaxY;
while ((Blue_y(PY2,1)>=5)&&(PY2PY2=PY2+1;
end
IY=I(PY1:PY2,:,:);
Blue_x=zeros(1,x);
for j=1:x
for i=PY1:PY2
if((myI(i,j,1)<=30)&&((myI(i,j,2)<=62)&&(myI(i,j,2)>=51))&&((myI(i,j,3) <=142)&&(myI(i,j,3)>=119)))
Blue_x(1,j)= Blue_x(1,j)+1;
end
end
end
PX1=1;
while ((Blue_x(1,PX1)<3)&&(PX1PX1=PX1+1;
end
PX2=x;
while ((Blue_x(1,PX2)<3)&&(PX2>PX1))
PX2=PX2-1;
end
PX1=PX1-2;
PX2=PX2+2;
Plate=I(PY1:PY2,PX1-2:PX2,:);
t=toc