No Idea with what to start in this case i have to extract the red block image from following tiff Image 
After extracting I have to read the graph and get output as follows :-
if
1 – Off Duty
2 – Sleeper Berth
3 – Driving
4 – On Duty
then following graph Should give as 22222243333131331332222 . what algorithm should be used I am using C# as programming Language
Maybe MODI will help you:
http://www.codeproject.com/Articles/29172/Converting-Images-to-Text-using-Office-2007-OCR-Op
Updated:
I think, you tried correctly way (AForge.net).
With AForge.Math.Geometry.SimpleShapeChecker class, you will find all rectangles.
I will try again.
Updated
with Aforge.net you may compare two image. In your problem, you need compare with original empty cell(standard cell) each cell. And order by similarity, so first 24 cells are (that most not similar cells) that you need.
like this: