views:

130

answers:

3

alt text

Is there a simple solution in MATLAB?

A: 

For a simple one like that you can probably just run a median filter and ocr.

A median filter will, for every pixel in the image, look at the area around it, usually a 3x3 or 5x5 pixel area, determine the median pixel value in that area and set the pixel to that median value. In a block of the same colour nothing will happen, the whole area is the same colour as the pixel under consideration so the median i sthe same as the current value (or at least almost the same permitting slight colour variations. On the other hand noise pixels, i.e. a single pixel with a differently coloured area around it will simply disappear, since the median value of the area will be the colour of all the pixels around the noise pixel.

As for the ocr, or optical character recognition, I'd just use an existing program/library, it would certainly be possible to write an ocr algorithm in Matlab, but would be a much bigger exercise than writing a simple algorithm in an hour. You'd first need to read up on ocr techniques and algorithms.

wich
Can you elaborate a little?
I've expanded the answer
wich
+1  A: 

Easy answer: NOPE

Daniel DiPaolo
A: 

For very simple: read the image as grayscale, threshold, clean up and run it through an ocr program.

%# read the image
img = imread('http://internationalpropertiesregistry.com/Server/showFile.php?file=%2FUpload%2F02468.gif358455ebc982cb93b98a258fc4d6ee60.gif');

%# threshold
bw = img < 150; 

%# clean up
bw = bwareaopen(bw,3,4);

%# look at it - the number 8 is not so pretty, the rest looks reasonable
figure,imshow(bw)

Then, figure out whether there is an OCR program that can help, such as this one

For even simpler:

%# read the image
[img,map] = imread('http://internationalpropertiesregistry.com/Server/showFile.php?file=%2FUpload%2F02468.gif358455ebc982cb93b98a258fc4d6ee60.gif');

%# display
figure,imshow(img,map)

%# and type out the numbers. It's going to be SO much less work than writing complicated code
Jonas
I'm trying to implement a very simple ocr in MATLAB..
Then you may want to look at the one I liked for inspiration - there is no built-in ocr in Matlab.
Jonas
Do you know how to run median filter on an image?
`out = medfilt2(img)`; Look at the help to medfilt2 for more details.
Jonas
Can you also explain what does `bw = img < 150; ` mean in your code above?
I'm thresholding the image. Pixels with intensity less than 150 are set to 1, others to 0.
Jonas
What's the maximum value for intensity in MATLAB?
For a 8-bit image, the maximum intensity is 255.
Jonas

related questions