0

From so many bounding box in image,i want bounding box of particular height and width ratio. I have created bounding box around 32 different objects.

Firstly i have to label each bounding box. Then I want to calculate values for a particular box and in output i want bounding boxes of that particular height and width ratio. How to do this.

My code is:

 f=imread('G:\..pooja project\prjct nw\r.jpg');  
 f=imresize(f,[400 NaN]); % Resizing the image keeping aspect ratio same.

 g=rgb2gray(f); 
 g=medfilt2(g,[3 3]);


 se=strel('disk',1); 
 gi=imdilate(g,se);
 ge=imerode(g,se); 

 gdiff=imsubtract(gi,ge); 
 gdiff=mat2gray(gdiff);
 gdiff=conv2(gdiff,[1 1;1 1]);      
 gdiff=imadjust(gdiff,[0.5 0.7],[0 1],0.1);   .
 B=logical(gdiff); 


er=imerode(B,strel('line',50,0));
out1=imsubtract(B,er);


F=imfill(out1,'holes');
figure(2) ,imshow(F)
H=bwmorph(F,'thin',1);
H=imerode(H,strel('line',3,90));
figure(3),imshow(H)

final=bwareaopen(H,100);


figure(4),imshow(final);


[Ilabel num]=bwlabel(final);
disp(num)
figure(7),imshow(final)
Iprops=regionprops(Ilabel);
stats = regionprops(final,'eccentricity','orientation','area')
%stats()
Ibox=[Iprops.BoundingBox];
Ibox=reshape(Ibox,[4 num]);
for cnt=1:num
rectangle('position',Ibox(:,cnt),'edgecolor','r');
Pradeep Kumar
  • 6,836
  • 4
  • 21
  • 47
pooja
  • 1
  • 2
  • What language? Also, it would help you get better answers if you post the relevent parts of your code. – Pradeep Kumar Aug 05 '15 at 04:55
  • after creating bounding box, i dont know how to separate required bounding box.I want to extract only letters and numbers of the plate. – pooja Aug 07 '15 at 04:28

0 Answers0