UDOO camera and V4L2

Discussion in 'Accessories' started by nicola, Apr 23, 2014.

  1. nicola

    nicola Member

    Joined:
    Apr 23, 2014
    Messages:
    45
    Likes Received:
    0
    Hi all.

    I have a UDOO quad with the UDOO camera module and i'm developing a computer vision software.
    For my project i need to be able to change parameters like exposure times, brightness etc. I tried querying the camera using the cli program v4l2-ctl or the gui program v4l2ucp or via C code calling ioctl() without success. I succeded to obtain images from the camera using V4L2 but i'm unable to access any control.

    I tried replacing the UDOO camera with some webcam and the controls are available and working both using precompiled programs and with my software.

    I tried the debian armhf images and the 12.04 ubuntu image with the same result. I was hoping the fix to the camera cited into the changelog of the debian 1.1 version to be of some help but for me it worked the same as before.

    Is the UDOO camera supposed to allow interfacing with the controls?
    Is this problem going to be solved in the future?
     
  2. mikelangeloz

    mikelangeloz Member

    Joined:
    Jul 9, 2013
    Messages:
    129
    Likes Received:
    1
  3. nicola

    nicola Member

    Joined:
    Apr 23, 2014
    Messages:
    45
    Likes Received:
    0
    Thanks for the reply and sorry for my delay but i had to finish a work on the linaro ubuntu, i tested only now the UDOObuntu v1.

    I understand that the loopback v4l2 device creates a "virtual" device named /dev/video7 i can use to read the video. I found that the gstreamer interface to modify v4l2src parameters like brightness is called "colorbalance".

    I'm not sure i have understand your message.
    What i must do is write a pipeline reading from the device /dev/video7 with the gstreamer library element v4l2src and use the colorbalance interface. Is this what you meant?

    I'm just a little surprised that is possible to use the colorbalance interface in v4l2src even if the data came from the mfw_v4lsrc that don't have this interface.

    I found also that the colorbalance interface cannot be used in gst-launch so i must write a program using the gstreamer libraries to verify this solution.
    I inspected "just in case" the /dev/video7 device with v4l2-ctl but it shows only the following capabilities:
    Code:
                        keep_format (bool)   : default=0 value=0
                  sustain_framerate (bool)   : default=0 value=0
                            timeout (int)    : min=0 max=100000000 step=1 default=0 value=0
                   timeout_image_io (bool)   : default=0 value=0
    So the source code i have can't be used to control the brightness with only v4l2 library. I must test using gstreamer library, this may take some time :oops: .
     
  4. nicola

    nicola Member

    Joined:
    Apr 23, 2014
    Messages:
    45
    Likes Received:
    0
    Here I am again, I've tested gstreamer but the results are negative.

    I "wrote" a simple c program using gstreamer's colorbalance interface to control parameters like the brightness of the camera. Trying to access the video devices i got the following results:
    [*] /dev/video3 : it's a common USB webcam accessed through a v4l2src element: SUCCESS
    [*] /dev/video7: the v4l2src element made by the camera service: FAIL
    [*] /dev/video0: the original mfw_v4lsrc element: FAIL

    This is what I've done.
    I followed the tutorials in http://docs.gstreamer.com . "Playback Tutorial 5" does exactly what i needed but i wasn't able to make it work. Merging code from "Basic tutorial 2" and "Playback Tutorial 5" i obtained a working program. I tried to attach the source code in this post, if someone want to take a look. Beware, it's a pile of copy and paste :oops: .
    In UDOObuntu i had to install gstreamer dev packages
    Code:
    sudo apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev 
    I used cmake to compile so i had to install cmake. I found around the web the cmake modules to find gstreamer and the dependecies. The cmake command to compile is:
    Code:
    cmake -DCMAKE_MODULE_PATH=/home/ubuntu/src/testGstreamer/Modules /home/ubuntu/src/testGstreamer
    After compiling with a "make" I launched the program trying to access video3 and video7 and got the following output:
    Code:
    ubuntu@udoobuntu: ~/build/testGstreamer $ ./testGst /dev/video7
    USAGE: Choose one of the following options, then press enter:
     'C' to increase contrast, 'c' to decrease contrast
     'B' to increase brightness, 'b' to decrease brightness
     'H' to increase hue, 'h' to decrease hue
     'S' to increase saturation, 's' to decrease saturation
     'Q' to quit
    Opening device /dev/video7
    MFW_GST_V4LSINK_PLUGIN 3.0.8 build on Nov 19 2013 12:57:16.
    Channels not available
    full screen size:1920x1080
    [V4L Update Display]: left=0, top=0, width=1920, height=1080
    set v4l display crop sucessfully
    set v4l rotate sucessfully
    full screen size:1920x1080
    >>V4L_SINK: Actually buffer status:
    	hardware buffer : 12
    	software buffer : 0
    q
    Channels not available
    Running time 0:00:02.513999881 render fps 25.457
    Total rendered:64
    [--->FINALIZE v4l_sink
    
    In the integrated camera the "Channels not available" means i wasn't able to access the colorbalance channels.
    Code:
    ubuntu@udoobuntu: ~/build/testGstreamer $ ./testGst /dev/video3
    USAGE: Choose one of the following options, then press enter:
     'C' to increase contrast, 'c' to decrease contrast
     'B' to increase brightness, 'b' to decrease brightness
     'H' to increase hue, 'h' to decrease hue
     'S' to increase saturation, 's' to decrease saturation
     'Q' to quit
    Opening device /dev/video3
    MFW_GST_V4LSINK_PLUGIN 3.0.8 build on Nov 19 2013 12:57:16.
    Brightness: 0 in range -10 - 10
    Contrast: 10 in range 0 - 20
    Saturation: 4 in range 0 - 10
    White Balance Temperature, Auto: 1 in range 0 - 1
    Gamma: 150 in range 100 - 200
    Gain: 34 in range 32 - 48
    Sharpness: 5 in range 0 - 10
    
    full screen size:1920x1080
    [V4L Update Display]: left=0, top=0, width=1920, height=1080
    set v4l display crop sucessfully
    set v4l rotate sucessfully
    >>V4L_SINK: Actually buffer status:
    	hardware buffer : 12
    	software buffer : 0
    q
    Brightness: 0 in range -10 - 10
    Contrast: 10 in range 0 - 20
    Saturation: 4 in range 0 - 10
    White Balance Temperature, Auto: 1 in range 0 - 1
    Gamma: 150 in range 100 - 200
    Gain: 34 in range 32 - 48
    Sharpness: 5 in range 0 - 10
    
    Running time 0:00:04.222585495 render fps 3.316
    Total rendered:14
    [--->FINALIZE v4l_sink
    
    In the USB webcam the colorbalance channels where available.

    To test the original /dev/video0 the source code must be changed replacing "v4l2src" with "mfw_v4lsrc" at row 121.

    And now the question is: What have i done wrong :?:
     

    Attached Files:

Share This Page