check this picture out before I explain further: How can I count the amount of lines there are from the yellow line to line #5? OCR sounds like overkill, because I don't really care what the text says.
- scan your image horizontally, pixel-line wise
- each pixel line eithers contains only black pixels, or some white/yellow pixels: store this information in a boolean array.
- group the pixel line numbers together, each sequence of non-empty lines and each sequence of empty lines form a group. The non-empty line groups represent the word lines, and the empty-line groups represent the space between the word lines.
- so what remains is simply counting the groups
To deal with aliasing effects, you will probably have to refine this a little bit, for example, by interpreting pixel lines as empty when they contain only a few number of white pixels, or by expecting a minimum size for any group (see Lars Viklund's comment) . You will have to adapt this to the quality and resolution of your images.