Definition at line 197 of file common.py.
◆ __init__()
def var.common.RectSelector.__init__ |
( |
|
self, |
|
|
|
win, |
|
|
|
callback |
|
) |
| |
Definition at line 198 of file common.py.
198 def __init__(self, win, callback):
200 self.callback = callback
201 cv.setMouseCallback(win, self.onmouse)
202 self.drag_start =
None
203 self.drag_rect =
None
◆ dragging()
def var.common.RectSelector.dragging |
( |
|
self | ) |
|
Definition at line 230 of file common.py.
231 return self.drag_rect
is not None
◆ draw()
def var.common.RectSelector.draw |
( |
|
self, |
|
|
|
vis |
|
) |
| |
Definition at line 223 of file common.py.
224 if not self.drag_rect:
226 x0, y0, x1, y1 = self.drag_rect
227 cv.rectangle(vis, (x0, y0), (x1, y1), (0, 255, 0), 2)
◆ onmouse()
def var.common.RectSelector.onmouse |
( |
|
self, |
|
|
|
event, |
|
|
|
x, |
|
|
|
y, |
|
|
|
flags, |
|
|
|
param |
|
) |
| |
Definition at line 204 of file common.py.
204 def onmouse(self, event, x, y, flags, param):
205 x, y = np.int16([x, y])
206 if event == cv.EVENT_LBUTTONDOWN:
207 self.drag_start = (x, y)
210 if flags & cv.EVENT_FLAG_LBUTTON:
211 xo, yo = self.drag_start
212 x0, y0 = np.minimum([xo, yo], [x, y])
213 x1, y1 = np.maximum([xo, yo], [x, y])
214 self.drag_rect =
None
215 if x1-x0 > 0
and y1-y0 > 0:
216 self.drag_rect = (x0, y0, x1, y1)
218 rect = self.drag_rect
219 self.drag_start =
None
220 self.drag_rect =
None
◆ callback
var.common.RectSelector.callback |
◆ drag_rect
var.common.RectSelector.drag_rect |
◆ drag_start
var.common.RectSelector.drag_start |
◆ win
var.common.RectSelector.win |
The documentation for this class was generated from the following file:
- repos_for_Dox/cFp_Zoo/HOST/vision/common/languages/python/var/common.py