How to display characters on image properly?

I have a sample image, on which "speed" is written with pencil and then erased it completely...I need to display the image in binary format with black background and white characters, having characters properly displayed...can any one help...pls tell me any method at least that I should follow

 Réponse acceptée

Image Analyst
Image Analyst le 10 Juil 2015

0 votes

I'd probably try a tophat or bottomhat filter. They're in the help for the Image Processing Toolbox. Or you could try stdfilt().

8 commentaires

peyush
peyush le 10 Juil 2015
it's not working out properly...can you please suggest me any other method and thanks for your reply
Image Analyst
Image Analyst le 10 Juil 2015
You might try anisotropic diffusion or Gabor filtering.
Ashish Uthama
Ashish Uthama le 10 Juil 2015
stdfilt with thresholding shows promise (bw = stdfilt(img,ones(9))>4;)
Image Analyst
Image Analyst le 11 Juil 2015
Is this a student project, or a real problem? Because there are forensic methods to detect writing on pads of paper, like if someone wrote something on a Post-it note and peeled it away and took it. You can tell what they wrote by looking at the depressions on the remaining paper underneath the one they wrote on with a "profilometer" which essentially gives a topographic image. They are expensive instruments but if it's needed for your company or research grant, you could get one.
peyush
peyush le 11 Juil 2015
Modifié(e) : peyush le 11 Juil 2015
@Image Analyst...it is a part of my project and i need to recognise it automatically by using matlab...and while working with the script it is showing error... function anisotropic_diffusion() | Error: Function definitions are not permitted in this context.
how could i define the function...and thanks for your reply
peyush
peyush le 11 Juil 2015
Modifié(e) : peyush le 11 Juil 2015
@Ashish Uthama...i used stdfilt with thresholding and characters have got breaks with noise around
thanks for your reply
Image Analyst
Image Analyst le 11 Juil 2015
Modifié(e) : Image Analyst le 11 Juil 2015
peyush, of course I know it's your project. But it's always better to start with a good image than to try to fix up a bad image before you can even start the main processing. So what I'm saying is, if it's an important project you will do things to get a good image. Like try a profilometer. Or try multispectral imaging. Or try fluorescent imaging? Did you know that most white paper has fluorescent whitening agents (optical brighteners) in it whereas pencil lead and ink probably don't? Have you tried using a "black light" to take a photo? This should make the paper brighter and give more contrast with the writing.
These are the kinds of things a professional engineer would try. We need to look at all possible solutions - not just go with the first thing we think of.
I'm not saying that it can't be done, but it would be SO much easier if you had a good image to start with. For example, you can use sophisticated noise reduction methods like BM3D or non-local means. Did you try anisotropic diffusion or Gabor filters (often used in fingerprint processing)? If so, how did they work. If not, why not?
Why don't you try a Hessian filter like is used to track vessels and fibers, like a Frangi filter: http://www.mathworks.com/matlabcentral/fileexchange/24409-hessian-based-frangi-vesselness-filter?
The anisotropic diffusion demo I attached works perfectly fine. What you did was to paste that in at the bottom of your script. You can't have a function follow a script in the same m-file. You can have two functions though. So if your script is called test.m then you need to have this as the first line of code in test.m
function test()
Then, later on down the file you can have the anisotropic diffusion function. Be sure to alter it so that it uses your image instead of the demo images.
peyush
peyush le 11 Juil 2015
OK now I'll try to make a better looking image first...thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by