thanks for replying,
actually the idea of the project is how to extract the characters from the grid even though overlapping or intersection between them, the two objects have same color which is black , there for my solution was finding the straight lines , because the handwritten characters can not be straight.
but my problem is how to apply this solution?
Got it, but it shouldn't that hard.
Just scan from outside the frame, assume that the first pixel found belong to the frame, then move on from there, identify straight segments (start point, lenght and direction), deduce from the statistically the step of the grid, and that should get you the pixels.
You'll have to deal with the width of these lines too...