Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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:

  1 #!/usr/bin/env python
  2 
  3 from __future__ import print_function
  4 import stitcher
  5 #from imutils.video import VideoStream
  6 
  7 import numpy as np
  8 import datetime
  9 #import imutils
 10 import time
 11 import cv2
 12 import sys
 13 
 14 print("[INFO] starting cameras...")
 15 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")
 16 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")
 17 time.sleep(2.0)
 18 
 19 stitcher = cv2.createStitcher(False)
 20 total = 0
 21 
 22 while True:
 23         left = leftStream.read()
 24         right = rightStream.read()
 25 
 26         result = stitcher.stitch([left, right])
 27 
 28         if result is None:
 29                 print("[INFO] homography could not be computed")
 30                 break
 31 
 32         total += 1
 33         timeStamp = datetime.datetime.now()
 34         ts = timestamp.strftime("%A %d %B %Y %I:%M:%S%p")
 35         cv2.putText(result, ts, (10, result.shape[0] - 10),
 36                 cv2.FONT_HERSHEY_SIMPLEX, 0.35, (0, 0, 255), 1)
 37 
 38         cv2.imshow("result", result)
 39         cv2.imshow("left frame", left)
 40         cv2.imshow("right frame", right)
 41         key = cv2.waitKey(1) & 0xFF
 42 
 43         if key == ord("q"):
 44                 break
 45 
 46 print("[INFO] cleaning up...")
 47 cv2.destroyAllWindows()
 48 leftStream.stop()
 49 rightStream.stop()

THanks for any and all help & direction you may point me in.

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:

  1 #!/usr/bin/env python
  2 
  3  from __future__ import print_function
  4 import stitcher
  5 #from imutils.video import VideoStream
  6 
  7  import numpy as np
  8 import datetime
  9 #import imutils
 10 import time
 11 import cv2
 12 import sys
 13 
 14  print("[INFO] starting cameras...")
 15 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")
 16 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")
 17 time.sleep(2.0)
 18 
 19  stitcher = cv2.createStitcher(False)
 20 total = 0
 21 
 22  while True:
 23         left = leftStream.read()
 24         right = rightStream.read()
 25 
 26          result = stitcher.stitch([left, right])
 27 
 28          if result is None:
 29                 print("[INFO] homography could not be computed")
 30                 break
 31 
 32          total += 1
 33         timeStamp = datetime.datetime.now()
 34         ts = timestamp.strftime("%A %d %B %Y %I:%M:%S%p")
 35         cv2.putText(result, ts, (10, result.shape[0] - 10),
 36                 cv2.FONT_HERSHEY_SIMPLEX, 0.35, (0, 0, 255), 1)
 37 
 38          cv2.imshow("result", result)
 39         cv2.imshow("left frame", left)
 40         cv2.imshow("right frame", right)
 41         key = cv2.waitKey(1) & 0xFF
 42 
 43          if key == ord("q"):
 44                 break
 45 
 46  print("[INFO] cleaning up...")
 47 cv2.destroyAllWindows()
 48 leftStream.stop()
 49 rightStream.stop()

THanks for any and all help & direction you may point me in. in.