USB Camera on Raspberry Pi

Hi All,

I am trying Edge Impulse on Raspberry Pi 4, I am using USB camera, looks like the edge impulse is unable to detect the camera. Not sure if anyone faced similar issues. Can someone pls help to if someone resolved this issue?

Hello @MKMani,

Which version of the CLI are you using?
An upgrade might fix it.

Regards,

Louis

@MKMani can you run:

edge-impulse-linux --verbose

? It’ll print out everything that it finds.

Hi, Thanks for your quick response. Pls find below the version and the o/p from verbose.

pi@raspberrypi:~ $ edge-impulse-linux --verbose
Edge Impulse Linux client v1.2.2

[SER] Using microphone hw:0,0
[GST] Found devices: []
Failed to initialize linux tool Error: Cannot find any webcams, run this command with --disable-camera to skip selection
at /usr/lib/node_modules/edge-impulse-linux/build/cli/linux/linux.js:351:23
at processTicksAndRejections (node:internal/process/task_queues:94:5)

Just to add, I can confirm that USB camera is working as expected.

pi@raspberrypi:~ $ edge-impulse-linux --verbose
Edge Impulse Linux client v1.2.2

[SER] Using microphone hw:0,0
[GST] Found devices: []
Failed to initialize linux tool Error: Cannot find any webcams, run this command with --disable-camera to skip selection
at /usr/lib/node_modules/edge-impulse-linux/build/cli/linux/linux.js:351:23
at processTicksAndRejections (node:internal/process/task_queues:94:5)
pi@raspberrypi:~ $ fswebcam /tmp/a.jpg
— Opening /dev/video0…
Trying source module v4l2…
/dev/video0 opened.
No input was specified, using the first.
Adjusting resolution from 384x288 to 1280x720.
— Capturing frame…
GD Warning: gd-jpeg: JPEG library reports unrecoverable error: Not a JPEG file: starts with 0xc4 0x93Captured frame in 0.00 seconds.
— Processing captured image…
Writing JPEG image to ‘/tmp/a.jpg’.

1 Like

@MKMani Sorry for the late reply - could you post the output of gst-device-monitor-1.0 ?

Also, does the fswebcam command actually yield a useful picture?

— Capturing frame…
GD Warning: gd-jpeg: JPEG library reports unrecoverable error: Not a JPEG file: starts with 0xc4 0x93Captured frame in 0.00 seconds.

Worries me there!

Hi,
Thanks for your response. Yes fswebcam does produce a valid image. I see your point regarding the error message.

Pls find below the o/p device monitor command.

pi@raspberrypi:~ $ gst-device-monitor-1.0
Probing devices…

Device found:

    name  : USB           : USB
    class : Video/Source
    caps  : image/jpeg, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;
    properties:
            udev-probed = true
            device.bus_path = platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.2:1.0
            sysfs.path = /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.0/video4linux/video0
            device.bus = usb
            device.subsystem = video4linux
            device.vendor.id = 1b3f
            device.vendor.name = "USB\\x20\\x20\\x20\\x20"
            device.product.id = 2002
            device.product.name = "USB\ \ \ \ \ \ \ \ \ \ \ :\ USB"
            device.serial = USB_USB_Demo_1.00
            device.capabilities = :capture:
            device.api = v4l2
            device.path = /dev/video0
            v4l2.device.driver = uvcvideo
            v4l2.device.card = "USB\ \ \ \ \ \ \ \ \ \ \ :\ USB\ \ \ \ \ \ \ \ \ \ \ \ "
            v4l2.device.bus_info = usb-0000:01:00.0-1.2
            v4l2.device.version = 328787 (0x00050453)
            v4l2.device.capabilities = 2225078273 (0x84a00001)
            v4l2.device.device_caps = 69206017 (0x04200001)
    gst-launch-1.0 v4l2src ! ...

Device found:

    name  : bcm2835-isp
    class : Video/Sink
    caps  : video/x-raw, format=(string)YUY2, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ bt601 };
            video/x-raw, format=(string)UYVY, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ bt601 };
            video/x-raw, format=(string)I420, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ bt601 };
            video/x-raw, format=(string)YV12, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ bt601 };
            video/x-raw, format=(string)BGRA, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], interlace-mode=(string)progressive, colorimetry=(string){ sRGB };
            video/x-raw, format=(string)BGR, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], interlace-mode=(string)progressive, colorimetry=(string){ sRGB };
            video/x-raw, format=(string)RGB, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], interlace-mode=(string)progressive, colorimetry=(string){ sRGB };
            video/x-raw, format=(string)NV21, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ bt601 };
            video/x-raw, format=(string)NV12, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ bt601 };
            video/x-raw, format=(string)RGB16, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], interlace-mode=(string)progressive, colorimetry=(string){ sRGB };
            video/x-bayer, format=(string)grbg, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], colorimetry=(string){ 1:1:0:0 };
            video/x-bayer, format=(string)gbrg, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], colorimetry=(string){ 1:1:0:0 };
            video/x-bayer, format=(string)rggb, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], colorimetry=(string){ 1:1:0:0 };
            video/x-bayer, format=(string)bggr, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], colorimetry=(string){ 1:1:0:0 };
            video/x-raw, format=(string)GRAY8, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ 2:0:0:0 };
            video/x-raw, format=(string)YVYU, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ bt601 };
            video/x-raw, format=(string)GRAY16_LE, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ 2:0:0:0 };
    properties:
            udev-probed = true
            device.bus_path = platform-bcm2835-isp
            sysfs.path = /sys/devices/platform/soc/fe00b840.mailbox/bcm2835-isp/video4linux/video13
            device.subsystem = video4linux
            device.product.name = bcm2835-isp
            device.capabilities = :video_output:
            device.api = v4l2
            device.path = /dev/video13
            v4l2.device.driver = bcm2835-isp
            v4l2.device.card = bcm2835-isp
            v4l2.device.bus_info = platform:bcm2835-isp
            v4l2.device.version = 328787 (0x00050453)
            v4l2.device.capabilities = 2216689666 (0x84200002)
            v4l2.device.device_caps = 69206018 (0x04200002)
    gst-launch-1.0 ... ! v4l2sink device=/dev/video13

Device found:

    name  : bcm2835-isp
    class : Video/Source
    caps  : video/x-raw, format=(string)YUY2, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)UYVY, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)I420, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)YV12, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)BGRA, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)BGR, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)RGB, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)NV21, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)NV12, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)RGB16, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)YVYU, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
    properties:
            udev-probed = true
            device.bus_path = platform-bcm2835-isp
            sysfs.path = /sys/devices/platform/soc/fe00b840.mailbox/bcm2835-isp/video4linux/video14
            device.subsystem = video4linux
            device.product.name = bcm2835-isp
            device.capabilities = :capture:
            device.api = v4l2
            device.path = /dev/video14
            v4l2.device.driver = bcm2835-isp
            v4l2.device.card = bcm2835-isp
            v4l2.device.bus_info = platform:bcm2835-isp
            v4l2.device.version = 328787 (0x00050453)
            v4l2.device.capabilities = 2216689665 (0x84200001)
            v4l2.device.device_caps = 69206017 (0x04200001)
    gst-launch-1.0 v4l2src device=/dev/video14 ! ...

Device found:

    name  : bcm2835-isp
    class : Video/Source
    caps  : video/x-raw, format=(string)YUY2, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)UYVY, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)I420, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)YV12, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)NV21, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)NV12, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
            video/x-raw, format=(string)YVYU, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
    properties:
            udev-probed = true
            device.bus_path = platform-bcm2835-isp
            sysfs.path = /sys/devices/platform/soc/fe00b840.mailbox/bcm2835-isp/video4linux/video15
            device.subsystem = video4linux
            device.product.name = bcm2835-isp
            device.capabilities = :capture:
            device.api = v4l2
            device.path = /dev/video15
            v4l2.device.driver = bcm2835-isp
            v4l2.device.card = bcm2835-isp
            v4l2.device.bus_info = platform:bcm2835-isp
            v4l2.device.version = 328787 (0x00050453)
            v4l2.device.capabilities = 2216689665 (0x84200001)
            v4l2.device.device_caps = 69206017 (0x04200001)
    gst-launch-1.0 v4l2src device=/dev/video15 ! ...
1 Like

@MKMani So the issue is that your camera is advertising just camera capabilities, not video capabilities:

    caps  : image/jpeg, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1;

Rather than video/x-raw which we expected. I’ve tested this out with a Logitech cam and we can set up a pipeline for the image/jpeg usecase too, we’ll release a 1.2.4 patch release for the Linux CLI later today.

edit: Patch has now been released, thanks a lot for the debug logs!

1 Like

Thanks for your great support, Let me test the patch release.

1 Like

Thanks Jan, I am able to see that the camera is now connected.

1 Like