0

I apologize but I’m hoping someone here can help.

I have connected the THETA S to my laptop with a USB cable to acquire images on a Python program, but after a few minutes to a few dozen minutes of standing, I am unable to acquire images.

Python program

import cv2

# Set device ID to 2 to get converted images from THETA.
cap = cv2.VideoCapture(2)
while True:
  ret, image = cap.read()
  if not ret:
     break

  cv2.imshow("ok", image)
  if cv2.waitKey(1) & 0xFF == ord("q"):
     break

After the disconnection, this is the image that will be entered.

THETA UVC Blender Status:0x800705AA

Anyone can give me their opinion.

It may have something to do with the fact that the USB cable is 5 meters long, but so far we are dealing with the following on a Windows PC.

  • Disable the USB selective suspend setting.
  • Set the power option to High Performance.

1 Answers1

0

it appears as though you have basic errors with your code.

for a start args was never defined, so the given code throws and error on this line.

Here is a basic working script to get a camera working:

import cv2

# Open the camera
camera = cv2.VideoCapture(0)

while True:
    # Get a frame from the camera
    ret, frame = camera.read()

    # Display the frame
    cv2.imshow("Camera", frame)

    # Exit the loop if the 'q' key is pressed
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# Release the camera and close the window
camera.release()
cv2.destroyAllWindows()

The above works on my windows10 laptop with python3.10 and latest cv2 version.

D.L
  • 4,339
  • 5
  • 22
  • 45
  • Thank you for your response. I didn't notice the problem because I had cut out a part of the program and described it. We will correct the question as well. – user21078151 Jan 25 '23 at 08:35
  • RICOH THETA cameras suggest using the original USB cable. The 5 meter-long USB cable may be causing issues. – Jesse Casman Jan 25 '23 at 13:26
  • @JesseCasman, this could well be the case too (hardware). The answer here was highlighting the **error in the code itself** and **correct implementation** of this (software). – D.L Jan 25 '23 at 16:57
  • 1
    @Jesse Casman Thank you for your response. I think that is the problem too. As a way to deal with this, I will try the THETA original USB cable and a USB extension cable with repeater function. – user21078151 Jan 26 '23 at 05:41