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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | afcc1dde89227a458f91a30c3d8ef4732ea0766f6738a42ce4cf215e2e5cd0fd |
|
MD5 | 30c3add7166d696c4f1a180e506d5b1e |
|
BLAKE2b-256 | 09d3a0727abeed3817565f6f6cc095a5101c96d26eb1eba7751bbbce701d831d |
Close
Hashes for image2layout_computer_vision-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ac34a274909836dc35ad8a1dc73ff7c5dad5cee793183f7e94ddb12d87a5291 |
|
MD5 | 16ee89d0ce1ec777adf480f5126603d9 |
|
BLAKE2b-256 | 058b6acd98b979d626466e42e716cfd53997e37e606570e7213bc1fdb12e2176 |