article extraction from newspaper image in python and opencv

前端 未结 1 1479
一生所求
一生所求 2021-02-06 13:00

\"first

相关标签:
1条回答
  • 2021-02-06 13:15

    I have an approach worked for most of the images.

    1. Binary conversion of color/gray scale images using PIL/Opencv.
    2. Remove pictures from image as contours with largest area compared to average area of all the contours present in the image.
    3. Remove lines using canny edge filter and houghlines
    4. Use RLSA(run length smoothing algorithm) on this binary image. Description and Code for this RLSA can be found on this repository https://github.com/Vasistareddy/python-rlsa

    Removing lines helps because some e-papers keeps lines as article separator. We can achieve better results with more processing of the images. Heuristics like average width, average height, average area can be implemented on the contours left on the image after applying above steps to achieve better results.

    Coming to the above question, the articles always with the white background. Without white background are clearly "Ads" or "pictures" or "miscellaneous" stuff. Removing pictures from the above 4 mentioned steps clears solves this issue.

    PS: Choosing a value for RLSA horizontal and vertical is always mystery. Since the gap of the article varies from edition to edition.

    Edit:

    the above problem is basically applying Heuristics. Read through this

    https://medium.com/@vasista/extract-title-from-the-image-documents-in-python-application-of-rlsa-58f91237901f

    0 讨论(0)
提交回复
热议问题