Polygon Filler
Project description
PolyFiller
Python module for polygon filling on images.
Installation
Package Installation from PyPi
$ pip install polyfiller-g4
Package Installation from Source Code
The source code is available on GitHub.
Download and install the package:
$ git clone https://github.com/Genzo4/polyfiller
$ cd polyfiller
$ pip install -r requirements.txt
$ pip install .
Basic usage
-
Import:
from polyfiller_g4 import PolyFiller
-
Create instance:
Create an instance of the PolyFiller. You can specify additional options:
- ext - extension to add to the output file. Default value: fill.
- color - filling color. Default value: 0 (black).
pf = PolyFiller(ext='add_ext', color=(255, 0, 0))
-
Add filling polygons (0 or many)
pf.addPolygon([[0, 0], [1919, 0], [1919, 682], [1277, 385], [951, 374], [0, 615]])
pf.addPolygon([[100, 100], [200, 100], [150, 150]])
-
Filling frame
pf.fill('frame_1.png')
pf.fill('frame_2.png')
...
pf.fill('frame_n.png')
Output files are created with the extension added.
See the example.py file for an example of usage.
PolyFiller
Python модуль для заливки многоугольника\ов на изображении однотонным цветом.
Установка
Установка пакета с PyPi
$ pip install polyfiller-g4
Установка пакета из исходного кода
Исходный код размещается на GitHub.
Скачайте его и установите пакет:
$ git clone https://github.com/Genzo4/polyfiller
$ cd polyfiller
$ pip install -r requirements.txt
$ pip install .
Использование
-
Подключаем:
from polyfiller_g4 import PolyFiller
-
Создаём экземпляр
Создаём экземпляр PolyFiller. Можно указать дополнительные параметры:
- ext - расширение, добавляемое к выходному файлу. Значение по умолчанию: fill.
- color - цвет заливки. Значение по умолчанию: 0 (чёрный цвет).
pf = PolyFiller(ext='add_ext', color=(255, 0, 0))
-
Добавляем полигоны для заливки (0 или много)
pf.addPolygon([[0, 0], [1919, 0], [1919, 682], [1277, 385], [951, 374], [0, 615]])
pf.addPolygon([[100, 100], [200, 100], [150, 150]])
-
Заливка изображений
pf.fill('frame_1.png')
pf.fill('frame_2.png')
...
pf.fill('frame_n.png')
Создаются выходные файлы с добавленным расширением.
Пример использования см. в файле example.py
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
polyfiller_g4-1.2.0.tar.gz
(6.2 kB
view hashes)
Built Distribution
Close
Hashes for polyfiller_g4-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc5122a79f8e8e5c9feb238992be556e44b89c2e6cc6cbf979cf563a5b4f7014 |
|
MD5 | ce505ce86876581ada15406b40611d25 |
|
BLAKE2b-256 | cb14e10144db88a96940fe35f93bd13aa3fcf874d05f479ab2ea99b12ee6e325 |