Skip to main content

CharSplit

CharSplit is a lightweight Python library that segments an image containing text into individual character images. Each extracted character is returned as a NumPy matrix, making it easy to use in OCR, computer vision, and machine learning pipelines.

PyPI version License

Features

  • Extracts individual characters from a text image
  • Returns each character as a NumPy array
  • Accepts both image paths and OpenCV images
  • Characters are returned in left-to-right order
  • Simple API
  • Built with OpenCV and NumPy

Installation

pip install charsplit

Quick Start

from charsplit.charsplit.main import splitCharsFromImage as split

characters:list[list[list[float]]] = split("text.png")

print(f"Detected {len(characters)} characters.")

for char in characters:
    print(char.shape)

Example

Input image:

12345
from charsplit import split

characters = split("digits.png")

Output:

[
    array(...),  # 1
    array(...),  # 2
    array(...),  # 3
    array(...),  # 4
    array(...),  # 5
]

Each element is a NumPy matrix representing one segmented character.

API

split(image)

Segments an image into individual character matrices.

Parameters

Name Type Description
image str or numpy.ndarray Image path or loaded OpenCV image

Returns

List[numpy.ndarray]

A list of character images ordered from left to right.

Applications

  • OCR preprocessing
  • Handwritten character recognition
  • Digit recognition
  • CAPTCHA segmentation
  • Character dataset generation
  • Deep learning preprocessing

Dependencies

  • Python 3.9+
  • NumPy
  • OpenCV

License

MIT License

Author

Siddharth Karna

Metadata

Release files for charsplit 0.1.1

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

Source distribution (sdist)

Source distribution for charsplit 0.1.1
File Size Uploaded Provenance Actions
charsplit-0.1.1.tar.gz 3.5 kB Without provenance Details for charsplit-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for charsplit 0.1.1
File Interpreter ABI Platform Actions
charsplit-0.1.1-py3-none-any.whl Python 3 none any Details for charsplit-0.1.1-py3-none-any.whl

Total release size: 7.8 kB

Release files / charsplit-0.1.1.tar.gz

Download URL charsplit-0.1.1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a5f657e28d22d66d25fc7261ee7372c86313f681be40cf02caec5c50b51dcb0b
BLAKE2b-256 checksum
How to use checksums
889b7e80ed8b72d1f5f066f420539cb25d89ab2e77187949ec5bbcd4746e4081
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / charsplit-0.1.1-py3-none-any.whl

Download URL charsplit-0.1.1-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9c95a98cad5f07a34bd07c10f0be8a1c8df31424d613c70fd6a7be760e80174
BLAKE2b-256 checksum
How to use checksums
2145d5d1c416f13d7254bf58adcb4752595520f45afbb7a46862f09592c9453a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for charsplit 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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