image processing and stuff
Project description
image2layout-computer-vision
Computer Vision related modules for image2layout
Installation
- Build and run Docker container, will contain the necessary requirements for all modules
sudo docker build --tag cv -f Dockerfile .
sudo docker run -it -v $(pwd):/app cv bash
- OR, Install Conda
curl https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh -o ~/conda.sh
bash ~/conda.sh -b -f -p /opt/conda
rm ~/conda.sh
conda init --all --dry-run --verbose
OCR - Text Detection
Installation [CPU]
Follow instructions in README to build and run docker container for all modules
Or install using conda locally:
Python [conda] + tesseract
sudo apt install tesseract-ocr libtesseract-dev -y
conda create -n ocr python=3.8 -y
conda activate ocr
conda install -n ocr pytorch=1.10 torchvision -c pytorch -y
python -m pip install Pillow pandas numpy
python -m pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.10/index.html
python -m pip install pyyaml==5.1 chardet pytesseract
python -m pip install --upgrade datasets transformers
Usage
from main import detect_text
# returns an ImageBoxes object
imageboxes = detect_text('path/to/image.png')
# draw boxes
imageboxes.draw_anno()
# dataframe
imageboxes.df
# boxes (x0, y0, x1, y1)
boxes = np.array(list(imageboxes.df['box'])).astype(int)
Color Extractor
Installation
Python
python -m pip install Pillow pandas numpy scikit-learn
Usage
from PIL import Image
from main import ColorExtractor
image = Image.open('path/to/image.png').convert('RGB')
color_extractor = ColorExtractor(image)
color_extractor.colors
color_extractor.color_bg # background color
color_extractor.color_fg # foreground color
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for image2layout_computer_vision-0.0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cc4b099e103a648047cfb3a121b858d4874ec61aa58ef20e806e4898ffa386c |
|
MD5 | aaa8cd3eb673bad80bbaf1fc93e99e8f |
|
BLAKE2b-256 | 5ba3131d39d02633daa3c744a1a8b48d26581c77c2ffcdb10a0847eae024c168 |
Close
Hashes for image2layout_computer_vision-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10887a9f42e513702c41c452e4f2edd6fdf11135928991f31c45fb800cc8deeb |
|
MD5 | aa35736525a004218f9014e260a03d31 |
|
BLAKE2b-256 | 70e1cc5041381a272e2113f9c2d80f5700d04fbd7bfe872659f690fb2f37f37f |