apple-ocr
Easy-to-Use Apple Vision wrapper for text extraction, scalar representation and clustering using K-means.
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.3%) to scientific vocabulary
Keywords
Repository
Easy-to-Use Apple Vision wrapper for text extraction, scalar representation and clustering using K-means.
Basic Info
- Host: GitHub
- Owner: louisbrulenaudet
- License: apache-2.0
- Language: Python
- Default Branch: main
- Homepage: https://github.com/louisbrulenaudet/apple-ocr
- Size: 146 KB
Statistics
- Stars: 112
- Watchers: 1
- Forks: 5
- Open Issues: 1
- Releases: 4
Topics
Metadata Files
README.md
Easy-to-Use Apple Vision wrapper for text extraction and clustering
apple_ocr is a utility for Optical Character Recognition (OCR) that facilitates the extraction of text from images. This Python-based tool is designed to help developers, researchers, and enthusiasts in the field of text extraction and clustering. It leverages a combination of various technologies to achieve this, including the Vision framework provided by Apple.

Features
Text Recognition:
apple_ocruses the Vision framework to recognize text within an image. It extracts recognized text and provides information about its confidence levels.Clustering: The tool can perform K-Means clustering on the extracted data. It groups similar text elements together based on their coordinates.
Interactive 3D Visualization:
apple_ocroffers an interactive 3D scatter plot using Plotly, displaying the clustered text elements. This visualization helps users gain insights into the distribution of text and text density.
Dependencies
The script relies on the following Python libraries: - Torch - NumPy - Pandas - Pillow - Scikit-learn - Plotly - Pyobjc
Usage
Here's how you can use apple_ocr:
Installation: Install the required libraries, including
Torch,NumPy,Pandas,Pillow,scikit-learn, andPlotly.Initialization: Create an instance of the
OCRclass, providing an image to be processed. ```python from apple_ocr.ocr import OCR from PIL import Image
image = Image.open("yourimage.png") ocrinstance = OCR(image=image) ```
Text Recognition: Use the
recognizemethod to perform text recognition. It will return a structured DataFrame containing recognized text, bounding box dimensions, text density, and centroid coordinates.python dataframe = ocr_instance.recognize()Clustering: Use the
clustermethod to perform K-Means clustering on the recognized text data. This method assigns cluster labels to each data point based on their coordinates.python cluster_labels = ocr_instance.cluster(dataframe, num_clusters=3)Visualization: Finally, use the
scattermethod to create an interactive 3D scatter plot. This plot visualizes the clustered text elements, including centroids, text density, and more.python ocr_instance.scatter()
Example
Here's an example of the entire process:
```python from apple_ocr.ocr import OCR from PIL import Image
image = Image.open("yourimage.png") ocrinstance = OCR(image=image) dataframe = ocrinstance.recognize() clusterlabels = ocrinstance.cluster(dataframe, numclusters=3) ocr_instance.scatter() ```
Citing this project
If you use this code in your research, please use the following BibTeX entry.
```BibTeX @misc{louisbrulenaudet2023, author = {Louis Brulé Naudet}, title = {Easy-to-Use Apple Vision wrapper for text extraction and clustering}, howpublished = {\url{https://github.com/louisbrulenaudet/apple-ocr}}, year = {2023} }
```
Feedback
If you have any feedback, please reach out at louisbrulenaudet@icloud.com.
Owner
- Name: Louis Brulé Naudet
- Login: louisbrulenaudet
- Kind: user
- Location: Paris
- Company: Université Paris-Dauphine (Paris Sciences et Lettres - PSL)
- Website: https://louisbrulenaudet.com
- Twitter: BruleNaudet
- Repositories: 81
- Profile: https://github.com/louisbrulenaudet
Research in business taxation and development (NLP, LLM, Computer vision...), University Dauphine-PSL 📖 | Backed by the Microsoft for Startups Hub program
GitHub Events
Total
- Issues event: 2
- Watch event: 27
- Fork event: 1
Last Year
- Issues event: 2
- Watch event: 27
- Fork event: 1
Committers
Last synced: over 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Louis Brulé Naudet | l****t@i****m | 7 |
| Shane Rogers | s****e@r****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 3
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 9 minutes
- Total issue authors: 3
- Total pull request authors: 1
- Average comments per issue: 0.33
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 2
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 2
- Pull request authors: 0
- Average comments per issue: 0.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- EcosistemaISC (1)
- jaydip-tss (1)
- CesarLaimito (1)
Pull Request Authors
- phoenixbox (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 116 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 9
- Total maintainers: 1
pypi.org: apple-ocr
An OCR (Optical Character Recognition) utility for text extraction from images.
- Documentation: https://apple-ocr.readthedocs.io/
- License: Apache Software License
-
Latest release: 1.0.8
published about 2 years ago