MCPcopy
hub / github.com/makelove/OpenCV-Python-Tutorial / on_mouse

Method on_mouse

官方samples/common.py:99–111  ·  view source on GitHub ↗
(self, event, x, y, flags, param)

Source from the content-addressed store, hash-verified

97 cv2.imshow(self.windowname, self.dests[0])
98
99 def on_mouse(self, event, x, y, flags, param):
100 pt = (x, y)
101 if event == cv2.EVENT_LBUTTONDOWN:
102 self.prev_pt = pt
103 elif event == cv2.EVENT_LBUTTONUP:
104 self.prev_pt = None
105
106 if self.prev_pt and flags & cv2.EVENT_FLAG_LBUTTON:
107 for dst, color in zip(self.dests, self.colors_func()):
108 cv2.line(dst, self.prev_pt, pt, color, 5)
109 self.dirty = True
110 self.prev_pt = pt
111 self.show()
112
113
114# palette data from matplotlib/_cm.py

Callers

nothing calls this directly

Calls 1

showMethod · 0.95

Tested by

no test coverage detected