python - Any way to determine no of text lines in image? -


actually, have find no of text lines in given image e.g. if having 2 images

from pil import imagegrab img1=imagegrab.grab([0,0,200,80]) img2=imagegrab.grab([300,0,500,80]) 

img1 img2

first 1 img1 , second 1 img2

how can input img1 , output 5 , if input img2 output 4 i.e. no of text lines in image

if want without ocr-ing text, typical approach, determine each line in image if has 1 or more 1 color.

the lines 1 color can assumed background transition more 1 color single color "bottom" line of text row. count transitions , you'll have number of lines of text in image.

this assumes:

  • characters of 1 line no extend bottom of cell drawn in (that mean there might never empty line if top line has g , bottom 1 f - or similar configurations)
  • there text , not pictures (as in samples).

Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -