2 if pyjevois.pro:
import libjevoispro
as jevois
3 else:
import libjevois
as jevois
53 self.
dict = cv2.aruco.Dictionary_get(cv2.aruco.DICT_4X4_50)
54 self.
params = cv2.aruco.DetectorParameters_create()
62 inimg = inframe.getCvBGRp()
82 outimg = cv2.Laplacian(inimg, -1, ksize=5, scale=0.25, delta=127)
85 grayimg = cv2.cvtColor(inimg, cv2.COLOR_BGR2GRAY)
86 corners, ids, rej = cv2.aruco.detectMarkers(grayimg, self.
dict, parameters = self.
params)
87 outimg = cv2.aruco.drawDetectedMarkers(outimg, corners, ids)
90 cv2.putText(outimg,
"JeVois Python Sandbox", (3, 20), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255,255,255))
93 fps = self.
timer.stop()
94 outheight = outimg.shape[0]
95 outwidth = outimg.shape[1]
96 cv2.putText(outimg, fps, (3, outheight - 6), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255,255,255))
99 outframe.sendCv(outimg)
105 idle, winw, winh = helper.startFrame()
111 x, y, iw, ih = helper.drawInputFrame(
"c", inframe,
False,
False)
114 inimg = inframe.getCvGRAYp()
131 edges = cv2.Canny(inimg, 100, 200)
135 mask = cv2.merge([edges, edges, edges, edges])
140 helper.drawImage(
"edges", mask,
True,
False,
True)
144 helper.drawCircle(50, 50, 20, 0xff80ffff,
True)
145 helper.drawRect(100, 100, 300, 200, 0xffff80ff,
True)
148 corners, ids, rej = cv2.aruco.detectMarkers(inimg, self.
dict, parameters = self.
params)
150 for (marker, id)
in zip(corners, ids):
151 helper.drawPoly(marker, 0xffff0000,
True)
152 helper.drawText(float(marker[0][0][0]), float(marker[0][0][1]),
"id={}".format(id), 0xffff0000)
155 fps = self.
timer.stop()
156 helper.iinfo(inframe, fps, winw, winh);
166 inimg = inframe.getCvGRAYp()
169 corners, ids, rej = cv2.aruco.detectMarkers(inimg, self.
dict, parameters = self.
params)
173 for (marker, id)
in zip(corners, ids):
174 jevois.sendSerial(
"Detected ArUco ID={}".format(id))