开发者

converting binary image to gray scale image in Matlab

开发者 https://www.devze.com 2023-02-20 14:45 出处:网络
I working on Optical Character Recognition system. I want to convert the license plate image from binary to gray scale.

I working on Optical Character Recognition system.

I want to convert the license plate image from binary to gray scale.

let's look at the next example:

this is the binary image:

converting binary image to gray scale image in Matlab

and this is the gray scale:

converting binary image to gray scale image in Matlab

what I want to know is if there is a way to convert it from binary to the gray, or this is not possible because i've lost the informati开发者_如何学Con when I converted the picture to binary at the beginning.

any idea how to do this? thanks


To convert a binary image of class logical to a grayscale image of class double, you simply call

double(yourBinaryImage)

EDIT

To revert from a binary image to the grayscale image you had before thresholding is impossible without the grayscale image, since by thresholding you have dropped all the grayscale texture information.


Maybe you can use the distance transform to achieve a gray scale image from a binary image. In MATLAB, try bwdist or something like that. The result, of course, will not be the original gray scale image.


I think you cannot exactly get the grayscale image which you have shown from the binary image. What you can do is convert the image into grayscale and then do gaussian noising to spread the edge and then you can also add random noise to the whole image. So, now your new grayscale image will look a lot different than binary image.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号