pie-chart-ocr
A tool to extract tabular data from pie charts, developed as a component of the CryptoSearchTools toolkit.
Note: The original repository was moved to https://git.ehtec.co/research/pie-chart-ocr. https://github.com/ehtec/pie-chart-ocr is a mirror.
Installation
Install via PyPi
You can install all tagged versions of piechartocr from PyPi:
python3 -m pip install --upgrade piechartocr
Note: You cannot run tests and examples from the PyPi installation. The required files need to be downloaded from Gitlab.
Build from source
Install Boost and Tesseract:
sudo apt install libboost-system-dev tesseract-ocr build-essential git
Clone this repository including submodules:
git clone --recursive https://github.com/ehtec/pie-chart-ocr.git
cd pie-chart-ocr
Install Python requirements:
python3 -m pip install -r requirements.txt
Compile libraries:
python3 setup.py build_ext
Create temporary directories:
mkdir temp
mkdir temp1
mkdir temp2
Unpack test charts:
unzip data/charts_steph.zip -d data
unzip data/charts_steph_upsampled.zip -d data
unzip data/generated_pie_charts_legend.zip -d data
unzip data/generated_pie_charts_without_legend.zip -d data
Usage
Run unit tests:
python3 -m nose2 --start-dir tests/ --with-coverage
Run legacy tests / examples:
python3 run_examples.py
Generate test data (mock pie charts):
python3 run_generate_test_data.py
To extract data from any pie chart:
from piechartocr import pie_chart_ocr
# Path to pie chart
path = "/path/to/my/chart.png"
# Extract data
data = pie_chart_ocr.main(path, interactive=False)
# Print the extracted list of tuples of the form [(percentage / 100, label)]
print(data["res"])
Metrics
These metrics are autogenerated by the CI-pipeline.
Metrics for mock pie charts with legend:
Metrics for mock pie charts without legend:
Metrics for real world pie charts (many of them in awful quality, some even unreadable for humans):
Metadata
Release files for piechartocr 0.6.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| piechartocr-0.6.6.tar.gz | 95.1 MB | Without provenance | Details for piechartocr-0.6.6.tar.gz |
Release files / piechartocr-0.6.6.tar.gz
| Download URL | piechartocr-0.6.6.tar.gz |
|---|---|
| Size | 95.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dceda30533b8db3c614f44fc9202d571dac305d9c62d683784c1add7f8d4b498
|
|
BLAKE2b-256 checksum How to use checksums |
40b1e68d1b3f89b82f2e1bee5af43c2a8f762ace4b9ef64143f92e0437ded264
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Security for piechartocr 0.6.6
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.