Python module for polygon filling on images.
$ pip install polyfiller-g4
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 .
from polyfiller_g4 import PolyFiller
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))
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')
Output files are created with the extension added.
See the example.py file for an example of usage.
Python модуль для заливки многоугольника\ов на изображении однотонным цветом.
$ 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))
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