TypeError: images is not a numerical tuple
Hello all,
I'm an OpenCV nube and am pretty clueless about writing the code currently. I found this code and adapted it to my needs but keep getting this compiling error. I've been troubleshooting it for over three days now and am about to go insane. So that's why I'm hoping anyone can help me.
I'm trying to stitch together two video feeds and am able to successfully get the feeds to work independently.
The following is my error:
Traceback (most recent call last):
File "cameraStitching.py", line 26, in <module>
result = stitcher.stitch([left, right])
TypeError: images is not a numerical tuple
Here is my code:
#!/usr/bin/env python
from __future__ import print_function
import stitcher
#from imutils.video import VideoStream
import numpy as np
import datetime
#import imutils
import time
import cv2
import sys
print("[INFO] starting cameras...")
leftStream = cv2.VideoCapture("nvcamerasrc sensor-id=0 ! video/x-raw(memory:NVMM), width=(int)640, height=(int)480,format=(string)I420, framerate=(fraction)30/1 ! nvvidconv flip-method=0 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink")
rightStream = cv2.VideoCapture("nvcamerasrc sensor-id=2 ! video/x-raw(memory:NVMM), width=(int)640, height=(int)480,format=(string)I420, framerate=(fraction)30/1 ! nvvidconv flip-method=0 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink")
time.sleep(2.0)
stitcher = cv2.createStitcher(False)
total = 0
while True:
left = leftStream.read()
right = rightStream.read()
result = stitcher.stitch([left, right])
if result is None:
print("[INFO] homography could not be computed")
break
total += 1
timeStamp = datetime.datetime.now()
ts = timestamp.strftime("%A %d %B %Y %I:%M:%S%p")
cv2.putText(result, ts, (10, result.shape[0] - 10),
cv2.FONT_HERSHEY_SIMPLEX, 0.35, (0, 0, 255), 1)
cv2.imshow("result", result)
cv2.imshow("left frame", left)
cv2.imshow("right frame", right)
key = cv2.waitKey(1) & 0xFF
if key == ord("q"):
break
print("[INFO] cleaning up...")
cv2.destroyAllWindows()
leftStream.stop()
rightStream.stop()
THanks for any and all help & direction you may point me in.
as long as folks here can't try your code, you won't get an answer. please try again, without line numbers.
Thanks for the tip.