Skip to main content

Locating texts in images using computer vision

Project description

text-detector (algorithm accuracy work in progress)

Locating texts in images using machine vision algorithms

This project aims to use only image processing techniques to locate text regions in the image. More detailed information about the approach is given this link
https://muthu.co/extracting-text-regions-from-an-image-using-geometric-properties/

Installation

pip install -r requirements.txt

Usage


import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
from skimage.io import imread

from text_detector import detect_text_regions

image_sample = 'sample_images/image7.jpg'
image = imread(image_sample)
box_groups = detect_text_regions(image)

fig, ax = plt.subplots()
for box in box_groups:
    minr = box[0]
    minc = box[1]
    maxr = box[2]
    maxc = box[3]
    rect = mpatches.Rectangle((minc, minr), maxc - minc, maxr - minr,
                              fill=False, edgecolor='red', linewidth=2)
    ax.add_patch(rect)

ax.add_patch(rect)
ax.imshow(image)
ax.set_axis_off()
plt.tight_layout()
plt.show()

Sample Results

Original Detected Text Regions

Notebook

All my experiments are in this notebook also part of the project where I make changes to the algorithm and them move it to the detector file. Text Segmentation in Image.ipynb

Accuracy

The accuracy depends a lot on the threshold parameters in the utils.thresholds.py file which may need tweaking for different kinds of datasets.

References

B. Epshtein, E. Ofek and Y. Wexler, "Detecting text in natural scenes with stroke width transform," 2010 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, San Francisco, CA, 2010, pp. 2963-2970.

Tran, Tuan Anh Pham et al. “Separation of Text and Non-text in Document Layout Analysis using a Recursive Filter.” TIIS 9 (2015): 4072-4091.

Chen, Huizhong, et al. "Robust Text Detection in Natural Images with Edge-Enhanced Maximally Stable Extremal Regions." Image Processing (ICIP), 2011 18th IEEE International Conference on. IEEE, 2011.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

text-detector-0.0.3.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

text_detector-0.0.3-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file text-detector-0.0.3.tar.gz.

File metadata

  • Download URL: text-detector-0.0.3.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3

File hashes

Hashes for text-detector-0.0.3.tar.gz
Algorithm Hash digest
SHA256 16e0c38cf6b56841979186245287da6a893545d37065d70b4cce5d06ee356e63
MD5 a757637d308d76bbd67dd078fe6a3b65
BLAKE2b-256 28540051b87978f578ba36c5419fd2f23c5c7d46462650ca153757ec9c597544

See more details on using hashes here.

File details

Details for the file text_detector-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: text_detector-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3

File hashes

Hashes for text_detector-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 330ba3380688cd45320f73f0d050bc7b3ffbe97f054849b62614fd577db6ec97
MD5 32bdacb1c1a5e0b393a9602431fe62c1
BLAKE2b-256 c508394fb770876fafe50c7952c902b36f3f567c5943d02b05fa80193b10a9f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page