Skip to main content

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.

Metadata

Release files for text-detector 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for text-detector 0.0.3
File Size Uploaded
text-detector-0.0.3.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for text-detector 0.0.3
File Interpreter ABI Platform
text_detector-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 9.9 kB

Release files / text-detector-0.0.3.tar.gz

Download URL text-detector-0.0.3.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
16e0c38cf6b56841979186245287da6a893545d37065d70b4cce5d06ee356e63
BLAKE2b-256 checksum
How to use checksums
28540051b87978f578ba36c5419fd2f23c5c7d46462650ca153757ec9c597544
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / text_detector-0.0.3-py3-none-any.whl

Download URL text_detector-0.0.3-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
330ba3380688cd45320f73f0d050bc7b3ffbe97f054849b62614fd577db6ec97
BLAKE2b-256 checksum
How to use checksums
c508394fb770876fafe50c7952c902b36f3f567c5943d02b05fa80193b10a9f9
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page