Compute Vertical Gradients for License Plate Localization

橙三吉。 提交于 2019-12-12 05:24:54

问题


I am new with MATLAB and trying to implement the following step of License Plate Localization:

Here's my progress so far.

Code:

[rows,cols] = size(img);
image_gradient = zeros(rows,cols);

for i =1:1:rows
    for j =1:1:cols-1
        image_gradient(i,j) = abs( img(i,j+1) - img(i,j) );
    end
end

figure,imshow(image_gradient);title('Gradient');

Output:

I will be indeed grateful if someone can guide me what I am doing wrong here.


回答1:


Well to start off you should understand that illumination is a pain in the backside. And you shall understand that as you keep learning new algorithms.

Looking at your first set of images you can see that the plate is a prominent part of the image. Number plates are designed to give this contrast between the characters and the background. Moreover the entire background is fairly smooth. When you look at the image on the bottom there are a lot of artifacts and sharp intensity transitions, This should explain why your gradient is noisy.

What you are essentilly trying to do is a filtering operation ( Or Convolution ) using a filter that looks like this [-1 1]. Look up matlab functions conv2 and filter.

To reduce the noise you should be performing an averaging operation along with the gradient. This will reduce the susceptibility to noise. So your final filter would look something like this [-1 1;-1 1;-1 1]. Make sure your filter values are normalized if your are trying other complex filters.

Detecting number plates is not easy with the proposed method. It should definitely get you started. But you really need to start reading up on some more algorithms.



来源:https://stackoverflow.com/questions/35608153/compute-vertical-gradients-for-license-plate-localization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!