title: How to do localization in license plate with Matlab?
body: <p>I want to develop an matlab program that can recognise the vehicle plate. </p>
  
  <p>But before it, i have to do localization of the plate in the "CAR" image.  </p>
  
  <p>HOW TO DO IT?</p>
  
  <p>I have read many paper that said methods like modified Hough Transform, Bottom hat, vertical smearing, Gabor Filtering..</p>
  
  <p>I Have 2 example codes, but the result image is wrong.</p>
  
  <p>Here is the <strong>my First code</strong> but the result is <strong>wrong</strong>.</p>
  
  <pre><code>I = imread('DSC_0512.JPG'); 
  BW = im2bw(I,0.4); 
  se = strel('rectangle', [2 20]); 
  BW_opened = imclose(BW,se); 
  figure, imshow(BW_opened,[]) 
  s=regionprops(BW_opened,'Area','BoundingBox'); 
  [hh,ii] = sort([s.Area],'descend'); 
  out = imcrop(I,s(ii(2)).BoundingBox); 
  figure,imshow(out); 
  </code></pre>
  
  <p>And here is my Second Code and the result is <strong>wrong too</strong>...</p>
  
  <pre><code>I = imread('DSC_0512.JPG');
  r = I(:,:,1);  %red plane 
  g = I(:,:,2);  %green plane
  b = I(:,:,3);  %blue plane
  BW = (r &gt;= 230) &amp; (r &lt;= 260) &amp; (g &gt;= 160) &amp; (g &lt;= 240) &amp; (b &gt;= 160) &amp; (b &lt;= 240);
  s = regionprops(BW, 'Area', 'BoundingBox');
  [HH, ii] = sort([s.Area], 'descend');
  out = imcrop(I, s(ii(1)).BoundingBox);
  imshow(out);
  </code></pre>
  
  <p>Here is examples of my <a href="http://i1360.photobucket.com/albums/r649/farhat1s/DSC_0512_zps17ebed93.jpg" rel="nofollow">images</a> and <a href="http://www.nobleforums.com/images/onyxm400/bmw/plate.jpg" rel="nofollow">this</a></p>
  
  <p>Please help me.. Any suggestionn ??</p>