Skip to content

OpenGLES Capture Example User Guide

sdunnington edited this page Jun 9, 2017 · 3 revisions

Overview and scripts

  • An example application for accessing the camera is provided.
  • The application uses V4L2 capture and OpenGLES display APIs.
  • The source code for the example application is available here: OpenGLES Capture Example Source
  • The application requires NV12 format to be used from vfe0_pix pipeline on /dev/video3.
    • The script cam0_nv12_1080_setup.sh will setup the camera pipeline for NV12 format.
    • If the pipeline was previously set for UYVY format then the entity connections must be reset first using the cam_reset_links.sh script.
    • The cam0_gstreamer_example.sh script performs the reset and configures the device for UYVY before running GStreamer based capture on /dev/video0.
    • The cam0_gles_capture_example.sh script performs the reset and configures the device for NV12 before running the OpenGLES based capture on /dev/video3.

Command line options

Option Description Default
-d device V4L2 Video capture device with NV12M output format /dev/video3
-s subdevice V4L2 Camera subdevice node /dev/v4l-subdev10
-v verbose output level INFO
-u test Capture display test to run CAPTURE_DISPLAY
  • It's important that device, -d, and sub-device, -s, map to the NV12 output and OV5640 camera repsectively. *With the pre-built images for this release -d /dev/video3 and -s /dev/v4l-subdev10 are the correct values.
  • To determine the right nodes media-ctl app may be used as shown below.
    • msm_vfe0_video3 device node should be used as the -d option.
    • ov5640 1-0078 device node should be used as the -s option.
$ sudo media-ctl -d /dev/media1 -p
***
- entity 49: msm_vfe0_video3 (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video3 # this is the -d option
        pad0: Sink
                <- "msm_vfe0_pix":1 [ENABLED,IMMUTABLE]
***
- entity 87: ov5640 1-0078 (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev10 # this is the -s option
        pad0: Source
                [fmt:UYVY8_2X8/1920x1080 field:none
                 crop:(0,0)/1920x1080]
                -> "msm_csiphy0":0 [ENABLED,IMMUTABLE]

Run time keyboard shortcuts

  • The application accepts run time keyboard inputs to control the camera sensor.
Shortcut Description
h Print the help menu to the console
q Quit the application cleanly
a Toggle auto-focus control between Continuous and Off
f Run auto focus once then hold the focus at that position
t Toggle between three different sensor test patterns
l Set the camera sensor to live video mode

Compilation

sudo apt-get install libx11-dev libxext-dev libdrm-dev
git clone https://github.com/D3Engineering/410c_camera_support/tree/master/opengles_capture
cd opengles_capture

# Optional debug flags
export DEBUG=1 

# Compile the application
make

Clone this wiki locally