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.

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.0

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.0
File Size Uploaded Provenance Actions
charsplit-0.1.0.tar.gz 3.4 kB Without provenance Details for charsplit-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 7.6 kB

Release files / charsplit-0.1.0.tar.gz

Download URL charsplit-0.1.0.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9406c820526fcafa241d38bf9a7c77e414e3414a3eefeda76f3913692cc5eeb7
BLAKE2b-256 checksum
How to use checksums
f54c388fbb6a2c43875d41832c2247224e801cf9746136e9a630ceb6b82f89ed
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.0-py3-none-any.whl

Download URL charsplit-0.1.0-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bcf25bc93437f18575759beecb656a470500071f268571bfd761f5cecedef84
BLAKE2b-256 checksum
How to use checksums
9c78b9389e4c80d669b76bcb29a7a66ad992bbfda2b972ec7f495bd85b5378d8
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.0

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