python中flag的用法_Python cv2.EVENT_FLAG_LBUTTON属性代码示例

本文整理汇总了Python中cv2.EVENT_FLAG_LBUTTON属性的典型用法代码示例。如果您正苦于以下问题:Python cv2.EVENT_FLAG_LBUTTON属性的具体用法?Python cv2.EVENT_FLAG_LBUTTON怎么用?Python cv2.EVENT_FLAG_LBUTTON使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在模块cv2的用法示例。

在下文中一共展示了cv2.EVENT_FLAG_LBUTTON属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: on_mouse

​点赞 6

# 需要导入模块: import cv2 [as 别名]

# 或者: from cv2 import EVENT_FLAG_LBUTTON [as 别名]

def on_mouse(self, event, x, y, flags, param):

pt = (x, y)

if event == cv2.EVENT_LBUTTONDOWN:

self.prev_pt = pt

elif event == cv2.EVENT_LBUTTONUP:

self.prev_pt = None

if self.prev_pt and flags & cv2.EVENT_FLAG_LBUTTON:

for dst, color in zip(self.dests, self.colors_func()):

cv2.line(dst, self.prev_pt, pt, color, 5)

self.dirty = True

self.prev_pt = pt

self.show()

# palette data from matplotlib/_cm.py

开发者ID:makelove,项目名称:OpenCV-Python-Tutorial,代码行数:18,

示例2: onmouse

​点赞 6

# 需要导入模块: import cv2 [as 别名]

# 或者: from cv2 import EVENT_FLAG_LBUTTON [as 别名]

def onmouse(self, event, x, y, flags, param):

x, y = np.int16([x, y]) # BUG

if event == cv2.EVENT_LBUTTONDOWN:

self.drag_start = (x, y)

return

if self.drag_start:

if flags & cv2.EVENT_FLAG_LBUTTON:

xo, yo = self.drag_start

x0, y0 = np.minimum([xo, yo], [x, y])

x1, y1 = np.maximum([xo, yo], [x, y])

self.drag_rect = None

if x1-x0 > 0 and y1-y0 > 0:

self.drag_rect = (x0, y0, x1, y1)

else:

rect = self.drag_rect

self.drag_start = None

self.drag_rect = None

if rect:

self.callback(rect)

开发者ID:makelove,项目名称:OpenCV-Python-Tutorial,代码行数:21,

示例3: onmouse

​点赞 6

# 需要导入模块: import cv2 [as 别名]

# 或者: from cv2 import EVENT_FLAG_LBUTTON [as 别名]

def onmouse(self, event, x, y, flags, param):

x, y = np.int16([x, y]) # BUG

if event == cv2.EVENT_LBUTTONDOWN:

self.drag_start = (x, y)

if self.drag_start:

if flags & cv2.EVENT_FLAG_LBUTTON:

xo, yo = self.drag_start

x0, y0 = np.minimum([xo, yo], [x, y])

x1, y1 = np.maximum([xo, yo], [x, y])

self.drag_rect = None

if x1-x0 > 0 and y1-y0 > 0:

self.drag_rect = (x0, y0, x1, y1)

else:

rect = self.drag_rect

self.drag_start = None

self.drag_rect = None

if rect:

self.callback(rect)

开发者ID:NetEase,项目名称:airtest,代码行数:20,

示例4: _onmouse

​点赞 6

# 需要导入模块: import cv2 [as 别名]

# 或者: from cv2 import EVENT_FLAG_LBUTTON [as 别名]

def _onmouse(self, *args):

if args[0] == cv2.EVENT_LBUTTONDOWN:

self.org_pitch, self.org_yaw, self.org_x, self.org_y, self.org_z =\

self.pitch,self.yaw,self.x,self.y,self.z

self.clickstart = (self.mousex, self.mousey)

if args[0] == cv2.EVENT_RBUTTONDOWN:

self.org_roll = self.roll

self.clickstart = (self.mousex, self.mousey)

if (args[3] & cv2.EVENT_FLAG_LBUTTON):

self.pitch = self.org_pitch + (self.mousex - self.clickstart[0])/10

self.yaw = self.org_yaw + (self.mousey - self.clickstart[1])

if (args[3] & cv2.EVENT_FLAG_RBUTTON):

self.roll = self.org_roll + (self.mousex - self.clickstart[0])/50

my=args[1]

mx=args[2]

self.mousex=mx/float(256)

self.mousey=my/float(256 * 2)

开发者ID:alexsax,项目名称:midlevel-reps,代码行数:23,

示例5: on_mouse

​点赞 6

# 需要导入模块: import cv2 [as 别名]

# 或者: from cv2 import EVENT_FLAG_LBUTTON [as 别名]

def on_mouse(self, event, x, y, flags, param):

pt = (x, y)

if event == cv.EVENT_LBUTTONDOWN:

self.prev_pt = pt

elif event == cv.EVENT_LBUTTONUP:

self.prev_pt = None

if self.prev_pt and flags & cv.EVENT_FLAG_LBUTTON:

for dst, color in zip(self.dests, self.colors_func()):

cv.line(dst, self.prev_pt, pt, color, 5)

self.dirty = True

self.prev_pt = pt

self.show()

# palette data from matplotlib/_cm.py

开发者ID:thunil,项目名称:TecoGAN,代码行数:18,

示例6: onmouse

​点赞 6

# 需要导入模块: import cv2 [as 别名]

# 或者: from cv2 import EVENT_FLAG_LBUTTON [as 别名]

def onmouse(self, event, x, y, flags, param):

x, y = np.int16([x, y]) # BUG

if event == cv.EVENT_LBUTTONDOWN:

self.drag_start = (x, y)

return

if self.drag_start:

if flags & cv.EVENT_FLAG_LBUTTON:

xo, yo = self.drag_start

x0, y0 = np.minimum([xo, yo], [x, y])

x1, y1 = np.maximum([xo, yo], [x, y])

self.drag_rect = None

if x1-x0 > 0 and y1-y0 > 0:

self.drag_rect = (x0, y0, x1, y1)

else:

rect = self.drag_rect

self.drag_start = None

self.drag_rect = None

if rect:

self.callback(rect)

开发者ID:thunil,项目名称:TecoGAN,代码行数:21,

示例7: onmouse

​点赞 6

# 需要导入模块: import cv2 [as 别名]

# 或者: from cv2 import EVENT_FLAG_LBUTTON [as 别名]

def onmouse(self, event, x, y, flags, param):

x, y = np.int16([x, y]) # BUG

if event == cv2.EVENT_LBUTTONDOWN:

self.drag_start = (x, y)

self.tracking_state = 0

if self.drag_start:

if flags & cv2.EVENT_FLAG_LBUTTON:

h, w = self.frame.shape[:2]

xo, yo = self.drag_start

x0, y0 = np.maximum(0, np.minimum([xo, yo], [x, y]))

x1, y1 = np.minimum([w, h], np.maximum([xo, yo], [x, y]))

self.selection = None

if x1-x0 > 0 and y1-y0 > 0:

self.selection = (x0, y0, x1, y1)

else:

self.drag_start = None

if self.selection is not None:

self.tracking_state = 1

开发者ID:fatcloud,项目名称:PyCV-time,代码行数:20,

示例8: onmouse

​点赞 5

# 需要导入模块: import cv2 [as 别名]

# 或者: from cv2 import EVENT_FLAG_LBUTTON [as 别名]

def onmouse(event, x, y, flags, param):

global seed_pt

if flags & cv2.EVENT_FLAG_LBUTTON:

seed_pt = x, y

update()

开发者ID:makelove,项目名称:OpenCV-Python-Tutorial,代码行数:7,

注:本文中的cv2.EVENT_FLAG_LBUTTON属性示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。

你可能感兴趣的:(python中flag的用法)