2

I'm using OpenCV with Python3 to capture images from a 720p WebCam on USB. It's operating on a headless processor, so I can't use the Cam application to check the device.

ubuntu@arm:~$ pkg-config --modversion opencv
3.2.0

ubuntu@arm:~$ readlink -f $(which python3) | xargs -I % sh -c 'echo -n "%: "; % -V'
/usr/bin/python3.6: Python 3.6.7

ubuntu@arm:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:        18.04
Codename:       bionic

The device is controlled by a python script, and runs perfectly for an hour. Some complaints about:

 Corrupt JPEG data: 2 extraneous bytes before marker 0xd5

The images captured are perfectly serviceable and it repeats quite happily, so I'm assuming this is harmless.

Then after about an hour it stops working. No user interaction, nothing I'm aware of interfering. It suddenly starts reporting:

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

After that point, nothing works. I can shutdown the script and reopen it. Nope. I currently open the camera on each loop of my sampler, a fresh cv2.VideoCapture(0) and a release() too. There is a battery on the unit, but it's under mains power. The USB hub is not powered, but that is due to hardware issues that would prevent use of the hub if it was powered... I'm assuming by the fact it's worked fine for over an hour, there is no link to the USB power arrangement.

A power cycle, shutdown -r, clears it and we are quite happy again.

v4l2-ctl -d /dev/video0 --all

Driver Info (not using libv4l2):
        Driver name   : uvcvideo
        Card type     : UVC Camera (046d:0825)
        Bus info      : usb-musb-hdrc.1-1.3
        Driver version: 4.14.108
        Capabilities  : 0x84200001
                Video Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps   : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
        Width/Height      : 640/480
        Pixel Format      : 'MJPG'
        Field             : None
        Bytes per Line    : 0
        Size Image        : 341333
        Colorspace        : sRGB
        Transfer Function : Default (maps to sRGB)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Full Range)
        Flags             :
Crop Capability Video Capture:
        Bounds      : Left 0, Top 0, Width 640, Height 480
        Default     : Left 0, Top 0, Width 640, Height 480
        Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 640, Height 480
Selection: crop_bounds, Left 0, Top 0, Width 640, Height 480
Streaming Parameters Video Capture:
        Capabilities     : timeperframe
        Frames per second: 30.000 (30/1)
        Read buffers     : 0
                     brightness 0x00980900 (int)    : min=0 max=255 step=1 defau                                                                         lt=128 value=128
                       contrast 0x00980901 (int)    : min=0 max=255 step=1 defau                                                                         lt=32 value=32
                     saturation 0x00980902 (int)    : min=0 max=255 step=1 defau                                                                         lt=32 value=32
 white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=1
                           gain 0x00980913 (int)    : min=0 max=255 step=1 defau                                                                         lt=64 value=131
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=2 valu                                                                         e=2
      white_balance_temperature 0x0098091a (int)    : min=0 max=10000 step=10 de                                                                         fault=4000 value=2610 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=255 step=1 defau                                                                         lt=24 value=24
         backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default                                                                         =0 value=0
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 valu                                                                         e=3
              exposure_absolute 0x009a0902 (int)    : min=1 max=10000 step=1 def                                                                         ault=166 value=667 flags=inactive
         exposure_auto_priority 0x009a0903 (bool)   : default=0 value=1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.