Skip to content

simple library to input various shapes like polygon rectangle and so on.

License

Notifications You must be signed in to change notification settings

moicci/cv2operator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cv2operator

cv2operator is a simple library to input various shapes like polygon rectangle and so on.

Features

  • LineOperator: input a line by mouse draggin
  • PolylineOperator: input a polyline by click
  • PolygonOperator: input a polygon by click
  • RectOperator: input a rectangle by draggin
  • BrushOperator: paint mask region by draggin
  • KeyOperator: key management

Usage

Here is a simple example.

import cv2
from cv2operator import KeyOperator, OperatorWindow, LineOperator

def line_cb(p1, p2):
    print(f"line: p1={p1}, p2={p2}")

image = cv2.imread("goru.jpg")
window = OperatorWindow("example", image)

line_op = LineOperator(window, callback=line_cb)

key_op = KeyOperator()
print(key_op.help())
key_op.main_loop()

Operators

all operators are used in a example code. see demo.py in examples.

RectOperator

image

LineOperator

image

PolylineOperator

image

PolygonOperator

image

BrushOperator

image

About

simple library to input various shapes like polygon rectangle and so on.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages