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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0f89303c54555c1fb48855826f6ad4acb2cd3cb2b49685139f773ce98f3eb0a |
|
MD5 | c4287f812dbc996c376a31b8640161f7 |
|
BLAKE2b-256 | 8b9b29181fb3fd1a49e41a441049369bfd999494dcf888c60cf729cadb6eb496 |
Close
Hashes for image2layout_computer_vision-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 860646b7d05a7e699bb38ccc910207d17c057e28a7e30b7c117cac5baa4b1bdf |
|
MD5 | 61c3d4446db762218b3f656334d4eeeb |
|
BLAKE2b-256 | c5962f23b707d13a80359a7460f73177a3b262be4d06adce6e8146564cea5865 |