2 if pyjevois.pro:
import libjevoispro
as jevois
3 else:
import libjevois
as jevois
6 import multiprocessing
as mp
15 return cv2.Canny(inimggray, threshold1 = th1, threshold2 = th2, apertureSize = 3, L2gradient =
False)
99 inimggray = inframe.getCvGRAY()
105 futures = [ self.
pool.apply_async(computefunc, args = (inimggray, 10*x, 20*x, ))
for x
in range(1,5) ]
113 try: results.append(futures[ii].get(timeout = 10))
114 except Exception
as e: error = e
115 if error:
raise error
120 h, w = results[ii].shape
121 str +=
"Canny {}: {}x{} ".format(ii, w, h)
124 jevois.sendSerial(str)
136 self.
pool = mp.Pool()
141 inimggray = inframe.getCvGRAY()
147 futures = [ self.
pool.apply_async(computefunc, args = (inimggray, 10*x, 20*x, ))
for x
in range(1,5) ]
155 try: results.append(futures[ii].get(timeout = 10))
156 except Exception
as e: error = e
157 if error:
raise error
160 outimggray = np.hstack(results)
163 fps = self.
timer.stop()
164 height, width = outimggray.shape
165 cv2.putText(outimggray, fps, (3, height - 6), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 255, 1, cv2.LINE_AA)
168 outframe.sendCvGRAY(outimggray)
178 self.
pool.terminate()