python - mat is not a numerical tuple : openCV error -
i have write down code showing error ma not getting it: please help: showing mat not numerical tuple:
import cv import cv2 capture = cv2.videocapture("j.3gp") while(1): _, frame1 = capture.read() grayimage1 = cv2.cvtcolor(frame1, cv2.color_bgr2gray) _, frame2 = capture.read() grayimage2 = cv2.cvtcolor(frame2, cv2.color_bgr2gray) differenceimage = cv2.absdiff(grayimage1,grayimage2) thresholdimage = cv2.threshold(differenceimage,25,255,cv2.thresh_binary) cv2.imshow("difference image", differenceimage) cv2.imshow("threshold image", thresholdimage) cv2.imshow("image", frame1) k = cv2.waitkey(30) & 0xff error arising : ----------------------------------------------------------------------------------------- traceback (most recent call last): file "desk.py", line 15, in <module> cv2.imshow("threshold image", thresholdimage) typeerror: mat not numerical tuple
i got anaswer self "cv2.threshould" returns 2 values , adding variable @ starting rectify error given bellow did in "capture.read()"
thresholdimage = cv2.threshold(differenceimage,25,255,cv2.thresh_binary)
should be:
_ ,thresholdimage = cv2.threshold(differenceimage,25,255,cv2.thresh_binary)
Comments
Post a Comment