def work_thread2(cam=0, pData=0, nDataSize=0):
stFrameInfo = MV_FRAME_OUT_INFO_EX()
memset(byref(stFrameInfo), 0, sizeof(stFrameInfo))
while True:
temp = np.asarray(pData)
temp = temp.reshape((2048, 1024, 3))
gray = cv2.cvtColor(temp,cv2.COLOR_BGR2GRAY)
ret,binary = cv2.threshold(gray,130,255,cv2.THRESH_BINARY)
cv2.namedWindow(
"binary", cv2.WINDOW_NORMAL)
cv2.namedWindow("ori", cv2.WINDOW_NORMAL)
cv2.imshow('binary',binary)
cv2.imshow("ori", temp)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
ret = cam.MV_CC_GetOneFrameTimeout(pData, nDataSize, stFrameInfo, 1000)
if ret == 0:
print("get one frame: Width[%d], Height[%d], nFrameNum[%d]" % (
stFrameInfo.nWidth, stFrameInfo.nHeight, stFrameInfo.nFrameNum))
else:
print("no data[0x%x]" % ret)
if g_bExit == True:
break
cv2.waitKey()