Allow access to the video stream for the camera (connected using USB or directly
to the target board)
Syntax:
rearview-camera -bsize=dimensions
[-actvid-hsync=actvid]
[-adaptive-dei-int-mode=mode]
[-adaptive-dei-motion-mode=admode]
[-brightness=level]
[-clock-pol=polarity]
[-color-test=colortesttype]
[-contrast=level][-cpos=coordinates]
[-csize=dimensions]
[-data-bus-width=buswidth]
[-device=deviceid]
[-display=displayid][-ddr-clk=clock]
[-dmode=deinterlacemode]
[-edma-chan=channel]
[-fid-pol=polarity][-fill=buffmem]
[-format=bufferformat]
[-frame-count=count][-frame-rate=rate]
[-hsync-pol=polarity][-hue=color]
[-interface-type=itype]
[-nbufs=numbuffers] [-nlanes=lanes]
[-norm=vstandard]
[-parent-zorder=zorder]
[-pipeline=pipelineid]
[-pos=coordinates] [-prio=tpriority]
[-quit-if-no-video] [-saturation=level]
[-sensor-clk-mode=mode]
[-sfsize=dimensions][-size=dimensions]
[-spos=coordinates] [-ssize=dimensions]
[-source=index] [-source-type=sourcetype]
[-sync-type=stype]
[-verbosity] [-video-info=vidinfo]
[-vsync-pol=polarity]
Options:
- -brightness=level
- An integer value in the range of -128–127 that specifies the brightness level to
use for capturing video.
- -bsize=dimensions
- (Required) A pair of integers that specifies the dimensions of the buffers.
The dimensions are delimited by an x. For example,
1024x800. The same buffer size is used to capture video and render
display.
- -clock-pol=polarity
- An integer value that controls whether the clock polarity is inverted for capturing
video. You can use the following values to specify polarity:
- 1 — Polarity is inverted.
- 0 — Polarity is not inverted.
- -1 — Don't set polarity. Use the default polarity set on the camera.
- -color-test=colortesttype
- An integer value that represents a color test. The colors are tested for the camera.
The color test type can be one of the following values:
- 1 — Test the contrast.
- 2 — Test the brightness.
- 3 — Test the saturation.
- 4 — Test the hue.
- -contrast=level
- An integer value in the range of -128–127 that specifies the level of contrast
to use for capturing video.
- -cpos=coordinates
- A pair of integers that specifies the position to crop the captured video. The
X and Y coordinates are delimited using a
comma (,). For example 10,10.
- -csize=dimensions
- A pair of integers that specifies the crop size to use for the captured video. The
dimensions are delimited by an x. For example,
790x593.
- -data-bus-width=buswidth
- An integer that specifies the width of the data bus for a parallel interface to use for
capturing video.
- -device=deviceid
- An integer that specifies the index of the device to use for capturing video.
- -display=displayid
- A string that represents a numeric value or a display type. As a numeric value, it's
used to represent the display ID. As a string value, it represents the display type
using one of these values, which are case-sensitive:
- internal
- An internal connection type to the display.
- composite
- A composite connection type to the display.
- svideo
- An S-Video connection type to the display.
- YPbPr
- The YPbPr signal of the component connection.
- rgb
- The RGB signal of the component connection.
- rgbhv
- The RBGHV signal of the component connection.
- dvi
- A DVI connection type to the display.
- hdmi
- An HDMI connection type to the display.
- other
- A connection type to the display which is one other than internal, composite,
S-Video, component, DVI, HDMI, or DisplayPort.
- -dmode=deinterlacemode
- A string that specifies the de-interlace mode to use for the captured video. The
mode can be specified using one of the following values, which are case-sensitive:
- adaptive
- Use motion adapative de-interlacing mode.
Note: For Texas Instruments Jacinto 6
and Freescale i.MX6x SABRE Smart Device targets, setting this value causes the motion-adaptive
de-interlacer (hardware) to be used.
- bob
- Use BOB de-interlacing mode.
- bob2
- Use alternate BOB de-interlace mode.
- none
- Don't de-interlace the video. This value is used if this option isn't set.
- weave
- Use WEAVE de-interlace mode.
- weave2
- Use alternate WEAVE de-interlace mode.
- -fid-pol=polarity
- An integer that controls whether the field ID polarity signal is inverted for captured video.
You can use the following values to specify polarity:
- 1 — Polarity is inverted.
- 0 — Polarity is not inverted.
- -1 — Don't set polarity. Use the default polarity set on the camera.
- -fill=buffmem
- An integer that specifies what the buffer is initialized with.
- -format=bufferformat
- A string that specifies the buffer format. If this option isn't set, the default
format is yvyu. The format can be specified using one of the following
values, which are case-sensitive:
- rgb888
- RGB888 format.
- uyvy
- UYVY format.
- yuy2
- YUY2 format.
- yvyu
- (default) YVYU format.
- -frame-count=count
- An integer that specifies the total frame count to be captured by the camera.
- -frame-rate=rate
- A float that specifies the expected frame rate (in frames per second) for capturing video.
- -hsync-pol=polarity
- An integer that controls whether the horizontal sync polarity is inverted. You can use the following values to specify polarity:
- 1 — Polarity is inverted.
- 0 — Polarity is not inverted.
- -1 — Don't set polarity. Use the default polarity set on the camera.
- -hue=color
- An integer in the range of -128–127 that specifies the color used for
capturing video.
- -interface-type=itype
- A string that specifies the type of interface used by the camera. The following
values can be used, which are case-sensitive:
- csi2
- The interface is a MIPI CSI2 interface.
- parallel
- The interface is parallel.
- -nbufs=numbuffers
- An integer that specifies the number of buffers created by the application. You
should allocate at least four buffers, but if you are using adaptive de-interlacing mode
(specified using the -dmode option), allocate at least ten buffers.
If this option isn't set, ten buffers are allocated when adaptive de-interlacing is
used; otherwise, four buffers are allocated.
- -nlanes=lanes
- An integer that specifies the number of CSI2 data lanes to be used for the camera.
- -norm=vstandard
- A string that specifies to use a National Television System Committee (NTSC), Phase
Alternating Line (PAL), or Sequential Color with Memory (SECAM) video standard. For more
information about:
The following video standard to capture video with can be specified using these
values, which are case-sensitive:
- NTSC_M_J
- Standard used in United States and Japan.
- NTSC_4_43
- A pseudo-color system that transmits NTSC encoding (not a broadcast format).
- PAL_M
- PAL format that uses 525 lines and 59.94 fields per second;
this video standard is used in Brazil.
- PAL_B_G_H_I_D
- PAL format using 625 lines and 50 fields per second with various
signal characteristics and color encodings.
- PAL_COMBINATION_N
- PAL format with narrow bandwidth that's used in Argentina, Paraguay,
and Uruguay.
- PAL_60
- Multi-system PAL support that uses 525 lines and 60 fields per second
(not a broadcast format).
- SECAM
- Video standard used mainly in France.
- -parent-zorder=zorder
- An integer that specifies the z-order of the parent window. The video rendering
window is an embedded window (child) of the parent window.
- -pipeline=pipelineid
- An integer that specifies the WFD pipeline ID. When an ID is specified, it indicates
to the Screen Graphics Subsystem to use a non-composited layer on the display.
The number of pipelines vary for each hardware platform and its behavior depends on a
number of factors used by Screen. For information about the
use of pipelines for composition, see "Understanding composition"
in the Screen Graphics Subsystem Developer's Guide.
- -pos=coordinates
- A pair of integers that specifies the position of the video window on the display. The
X and Y coordinates are delimited using a
comma (,). For example, 10,10.
- -prio=tpriority
- An integer that specifies the priority of the capture thread relative to the original thread priority.
The default relative priority is +20.
- -quit-if-no-video
- Stop rearview-camera when no video input is detected. Depending on
the decoder that's used, there may be a delay in detecting whether video input has
stopped.
- -reenable-delay=delaytime
- An integer that specifies the delay time (in milliseconds) to enable video capture
after it has stopped capturing the number of frames specified by the
-frame-count= option. If this option is not specified when the
-frame-count= option is specified, a prompt appears on command line
of the target to click the Enter key to continue video
capture.
- -saturation=level
- An integer in the range of -128–127 that specifies the intensity level of
color to use for capturing video.
- -sfsize=dimensions
- A pair of integers that specifies the dimensions of the source frame used for
capturing video. The dimensions are delimited by an x. For
example, 720x400.
- -size=dimensions
- A pair of integers that specifies the dimensions of the rectangle to show the video
on the display. The dimensons are delimited using an x. For example,
720x400.
- -ssize=dimensions
- A pair of integers that specifiy the dimensions of the source viewport used for the
captured video. The dimensions are delimited by an x. For
example, 1024x800.
- -source=index
- An integer that specifies the index of the device's video capture unit.
- -spos=coordinates
- A pair of integers that specifies the position of the source viewport. The
X and Y coordinates are delimited using a
comma (,). For example, 10,10.
- -ssize=dimensions
- A pair of integers that specifies the dimensions of the source viewport used for the
captured video. The dimensons are delimited using an x. For example,
1024x800.
- -verbosity
- An integer that specifies the verbosity level for debugging.
- -video-info=vidinfo
- An integer that specifies the number of frames to wait before checking for the video
information, such as NTSC_M_J or PAL_M.
- -vsync-pol=polarity
- An integer that controls whether the vertical sync polarity is inverted.
You can use the following values to specify polarity:
- 1 — Polarity is inverted.
- 0 — Polarity is not inverted.
- -1 — Don't set polarity. Use the default polarity set on the camera.
The following options are available only for specific platforms:
Platform |
Options |
Texas Instruments Jacinto 6 |
- -actvid-hsync=actvid
- An integer that specifies to use ACTVID style line capture. A value of
zero or one can be used to specify the ACTVID style. The default is negative
one (-1) when this option isn't set.
- -adaptive-dei-int-mode=mode
- A string that specifies the interpolation mode for the adaptive
de-interlacer. The mode can be specified using one of these values, which are
case-sensitive:
- mode0
- The interpolated field is created by line averaging from the YUV data.
That is, the interpolated line is created by averaging its top and
bottom lines.
- mode1
- The interpolated field is created by averaging pixels from fields
before and after the current field. For example, if the current field is
a top field, the interpolated bottom field is created by averaging
pixels from bottom field pictures before and after the current field.
- mode2
- This mode is an edge assisted interlace mode with edges detected from
the Luma information in the frame window. Luma for missing lines are
interpolated using original Luma along the detected edge. MV from the
MDT module is used to select coefficients from a LUT on how 2D
interpolation from the current field and 3D interpolation from two
fields adjacent to the current fields are blended.
- mode3
- The edge detection method used in this mode is similar to
interpolation mode 2. The only difference is that the edge-directed
interpolation is performed on both Luma and Chroma. Chroma is
interpolated similarly according to the edge vectors obtained based on
Luma information. This value is default if this option isn't
specified.
- -edma-chan=channel
- An integer that specifies the enhanced direct memory access (EDMA) channel
to use WEAVE2 de-interlacing. You can set a board-specific channel or use a
default EDMA channel. Use a range from 0–63 to specify a board-specific
channel; otherwise, use negative one (-1) to specify the default EDMA channel.
When there's no EDMA channel specified, the default channel is used. The
default EDMA channel number is bound to the specific device and source as
follows:
- channel 6 for device 0 and source 0
- channel 7 for device 1 and source 0
- channel 62 for device 0 and source 1
- channel 63 for device 1 and source 1
- -sync-type=stype
- An integer that specifies the synchronization signal type. You can set
from 0–15. Alternatively, set the value to negative one (-1) to use the
default channel.
|
Texas Instruments OMAP5 |
- -ddr-clk=clock
- An integer value that specifies the dual-data rate clock (MHz) of the
external CSI2 transmitter.
|
Freescale SABRE i.MX6x |
- -adaptive-dei-motion-mode=admode
- A string that specifies the motion mode for the adaptive de-interlacer.
The mode can be one of the following values, which are case-sensitive:
- low
- Do minimal conversion of interlaced fields to one progressive
frame.
- med
- (Default) Use default settings for converting interlaced fields to a
progressive frame.
- high
- Do as much processing as required to produce higher image quality.
It may introduce some delays.
- -sensor-clk-mode=mode
- An integer that specifies the sensor clock mode using one of the following
values:
- 0 — Gated clock.
- 1 — Non-gated clock.
- 2 — Progressive video interface CCIR 656.
- 3 — Interlaced video interface CCIR 656.
- 4 — Progressive video interface CCIR 1120 using double data
rate.
- 5 — Progressive video using standard data rate.
- 6 — Interlaced video interface CCIR 1120 using double data
rate.
- 7 — Interlaced video interface CCIR 1120 using standard data
rate.
|
The following options are available only for specific video decoders:
Video decoder |
Options |
Analog Devices ADV7x
|
- -source-type=sourcetype
- An integer that specifies the input source type. This option should be set
when you are setting the -source option. You can use the
following source types:
- 0 — Single-ended composite (CVBS).
- 1 — Sequential Color with Memory (SECAM).
- 2 — Component interface (pCBCr).
- 3 — Differential composite (CVBS).
|
Description:
The rearview-camera utility starts the rearview-camera service. This service
creates a parent window and an embedded window. The embedded window joins the parent window,
which is visible, so that the camera stream can be seen on the display. After the HMI is
running, it creates a window that the embedded window can join and drops the original
parent. The HMI creates an entry in a PPS object so the rearview-camera service knows what
window group to join.
To start the service manually, run the rearview-camera command
located at /base/usr/bin/rearview-camera.
In the QNX Apps and Media image, this command is run
from the camera-start.sh startup script.
The service creates raw images that are encoded with the following syntax:
format-widthxheight-stride-#seqno-rearviewcapture.raw
Before you can use the rearview-camera service, the touchscreen connected to your
target must be calibrated using the calib-touch utility. After the
touchscreen is successfully calibrated, you can use calib-touch to
save a configuration file to /etc/system/config/calib.
The rearview-camera service is built using Screen Graphics Subsystem to display
video and is captured using the Video Capture API Reference. For information about Screen Graphics Subsystem, see Screen Graphics Subsystem
Developer's Guide and Video Capture Library
Reference.
PPS objects:
The service uses the following PPS objects:
The rearview-camera service joins the window group that the HMI identifies in the
windowgroup object using the
rearview_camera attribute:
[n]rearview_camera::{94121bb8-4122-4dfb-8321-181eaf4c2553}
The rearview-camera service also listens to the
command
object and looks for either a
pause or
resume action,
which represents its new state:
rearview_camera:json:{"action": "pause"}
rearview_camera:json:{"action": "resume"}
Based on whether it enters the
pause or
resume state,
the service stops or starts rendering video.
Configuration file:
The camera is called from a startup script located at
/scripts/camera-start.sh. The script checks a configuration file
located at /var/etc/services-enabled. An attribute called
USBCAM can be set to true if a USBCAM is used on the target
board; otherwise, it's set to false. When a USBCAM is available, the
USB version of the libcapture library should be linked to
/base/usr/lib/libcapture.so.1; otherwise, the libcapture library for
the target should be linked to /base/usr/lib/libcapture.so.1.
For example, to link the USB version of the library, use the
following lines in your startup script on the
target:
ln -Psf /base/usr/lib/libcapture-usb-uvc.so
/base/usr/lib/libcapture.so.1
Otherwise, link the target-specific
libcapture library:
ln -Psf /base/usr/lib/libcapture-board-imx6x-sabreSMART.so
/base/usr/lib/libcapture.so.1
Examples:
To start USB camera for an existing HMI on an OMAP5432 EVM target:
rearview-camera -zorder=-1 -parent-zorder=-1 -pipeline=1 -format=yuy2
-sfsize=640x480 -bsize=640x480 -ddr-clk=384 -source=0
-nlanes=1
To start video capture with UYVY format, without any de-interlacing bound to pipeline
four:
rearview-camera -format=uyvy -pipeline=4 -dmode=none -bsize=720x240
To start video capture with YVYU format and adaptive de-interlace mode using
interpolation mode 3, bound to pipeline four, and video cropping size set to 720x400:
rearview-camera -bsize=720x480 -pipeline=4 -dmode=adaptive
-adaptive-dei-int-mode=mode3 -csize=720x400
Some formats aren't supported by the
service's encoding formats. For instance, FFmpeg is a format that isn't supported and
requires that you switch certain bits. You are responsible for handling the raw format
conversion. Often, this requires that you develop your own tools to convert the raw image
to another image format. For example, you might need to run the raw format through a tool
as shown here:
cat uyvy-720x480.raw | ffmpeg -vcodec rawvideo -f rawvideo
-pix_fmt uyvy422 -s 720x480 -i pipe:0
-f image2 -vcodec png uyvy-720x480.png
In this case, after you output the raw format to create an image, additional processing is required.
You may need to write a tool to handle this processing.