ai-thermometer icon indicating copy to clipboard operation
ai-thermometer copied to clipboard

USB camera issue

Open immkapoor opened this issue 4 years ago • 12 comments

I am using a simple logitech usb camera with jetson xavier but I am getting a uvc_find_error error but the camera is getting detected and activated. Everything is working well with simple codes.

immkapoor avatar Nov 04 '21 11:11 immkapoor

Can you please provide me the dependencies for this repo? Which versions of opencv and pytorch are you using?

immkapoor avatar Nov 07 '21 11:11 immkapoor

Hi!

The uvc_error is likely due to the purethermal module not getting detected (which is also a UVC device).

As far as the versioning goes:

  • OpenCV> 4.4
  • pytorch > 1.9

The latest releases of both should work.

On Sun, Nov 7, 2021 at 03:23 MK @.***> wrote:

Can you please provide me the dependencies for this repo? Which versions of opencv and pytorch are you using?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tomek-l/ai-thermometer/issues/45#issuecomment-962592880, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGHK36QSFFCSRSNFLO2H57LUKZORZANCNFSM5HLE2N2Q .

tomasz-lewicki avatar Nov 09 '21 02:11 tomasz-lewicki

@tomek-l Thank you for responding. I am using a FLIR E75 camera along with legion usb camera. Both are getting detected by other codes but i am getting a device error while running this code. I am using opencv v4.4.0. I am getting warnings from gstreamer. Can you suggest anything? It'll be helpful. Screenshot from 2021-11-09 12-25-58 r

immkapoor avatar Nov 09 '21 07:11 immkapoor

Hi @immkapoor,

Here you would change: https://github.com/tomek-l/ai-thermometer/blob/6be49fe3880a3381ed5b66a7fcbf8b74992ab476/rgb/rgb_thread.py#L24

To something like:

self._stream = cv2.VideoCapture("/dev/video1")  

Where /dev/video1 will be device handle to your USB webcam.

tomasz-lewicki avatar Nov 09 '21 07:11 tomasz-lewicki

I implemented this project with Raspberry Pi CM V2.1 which is a CSI (Camera Serial Interface) camera, which has different API than your USB camera - that's why you're getting errors.

Keep in mind that when you get these two to work without errors, you will still have to make sure that the images from the two cameras "align". It's fairly simple for FLIR Lepton 3.5 and Rpi CM V2.1, because they have very similar field-of-view.

tomasz-lewicki avatar Nov 09 '21 07:11 tomasz-lewicki

@tomek-l I made the suggested changes. But I am still getting the same error. The usb camera is getting enabled but I am not able to see the camera's capture screen. Do you think it's because of warnings raised by gstreamer Screenshot from 2021-11-09 13-44-37 ?

immkapoor avatar Nov 09 '21 08:11 immkapoor

That's odd. Did you remove the call to make_imx219_capture()? That's the line of code that initializes gstreamer pipeline.

tomasz-lewicki avatar Nov 09 '21 08:11 tomasz-lewicki

@tomek-l No, i haven't made any changes in code. Just added legion camera in init.py and flir camera in rgb_thread

immkapoor avatar Nov 09 '21 08:11 immkapoor

@tomek-l Hey, I was able to solve the Gstreamer warning by replacing cv2.VIdeoCapture("/dev/video*") in cv2.VIdeoCapture("/dev/video", cv2.CAP_V4L2) and if I do make_imx_capture() then I get uvc device error and program terminates. If I replace that with another simple video capture then also I get ucv find device error but nothing comes on screen. Do you have any idea?

immkapoor avatar Nov 14 '21 13:11 immkapoor

@tomek-l I am not able to find the find device error in init code of libuvc wrapper. Can you please tell me where its definition is coming from?

immkapoor avatar Nov 16 '21 10:11 immkapoor

Hi @immkapoor

These two are two separate methods of creating a camera device:

  • cv2.VIdeoCapture()
  • make_imx_capture()

You have to choose just one. Since you are working with a USB camera, I recommend doing cv2.VIdeoCapture("/dev/video0", cv2.CAP_V4L2) and deleting the make_imx_capture() call.

tomasz-lewicki avatar Nov 16 '21 19:11 tomasz-lewicki

As far as the error codes go, you can look them up in libuvc source code.

Specifically, in libuvc.h you have definitions of what each error number means.

tomasz-lewicki avatar Nov 16 '21 19:11 tomasz-lewicki