Video Capture
Import live video frames from Zynq-based system that has an HDMI FMC card
- Library:
Vision HDL Toolbox Support Package for Xilinx Zynq-Based Hardware
Description
The Video Capture block imports video frames from a Zynq®-based board that has an HDMI FMC card into your Simulink® model. The support package programs the FPGA with an image that includes data path multiplexers, video format conversions, and a video test pattern generator (TPG). You can control these data path and conversion options from the Video Capture block.
To capture video from a Zynq-based board that has a MIPI® FMC card, use the Video Capture MIPI block.
Points A
and B
in the diagram show the options for capturing video into
Simulink. The FPGA user logic section is the IP core that you generate from
your design using HDL Workflow Advisor. You can capture the input video before the FPGA user
logic, or the output video after the FPGA user logic. If you enable the bypass of the FPGA user
logic, or if you have not generated any FPGA user logic, the two capture locations show the same
data.
The video data is a pixel stream on the FPGA, but when you capture the video to Simulink, the stream is converted to frame-based video.
The reference design requires the same video resolution and color format for the entire data path. The resolution you select for the Video Capture block must match that of your camera input. The design you target to the FPGA user logic must not modify the frame size or format of the data.
Ports
Output
Y, Cb, Cr
— Color components of input video frame
matrix
The block returns one matrix for each color component of the input video. The dimensions
of the Y matrix match the frame size. The dimensions of the
Cb and Cr matrices are
height-by-width/2
because the
4:2:2 format alternates Cb and Cr values for each pixel in the frame.
Dependencies
To enable these ports, set Pixel format to YCbCr
4:2:2
.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| Boolean
| fixed point
R, G, B
— Color components of input video frame
matrix
The block returns one matrix for each color component of the input video. The dimensions of each matrix match the frame size.
Dependencies
To enable these ports, set Pixel format to
RGB
and Image signal to
Separate color signals
.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| Boolean
| fixed point
Image
— Color input video frame
matrix
The block returns a 3-by-height-by-width matrix, where height and width match the frame size.
Dependencies
To enable this port, set Pixel format to
RGB
and Image signal to One
multidimensional signal
.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| Boolean
| fixed point
Y
— Grayscale input video frame
matrix
The block returns a matrix whose dimensions match the frame size.
Dependencies
To enable this port, set Pixel format to Y
only
.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| Boolean
| fixed point
Parameters
Video source
— Source of video stream
HDMI input
(default) | Test pattern generator
The video stream through the FPGA logic and ARM® processor can start with input video from the HDMI port of the camera board or with generated video from the test pattern generator (TPG).
HDMI input
(default) — HDMI input port on the FMC-HDMI-CAM board. Set the Frame size parameter to match the resolution of your attached camera.Test pattern generator
— On-chip TPG.The TPG creates input frames at the requested resolution. The test pattern is a fixed color bar pattern. When you select the TPG, you do not need a camera or other HDMI source connected to the board.
Frame size
— Resolution of input video
480p SDTV (720x480p)
| 576p SDTV (720x576p)
| 720p HDTV (1280x720p)
| 1080p HDTV (1920x1080p)
| 640x480p
| 800x600p
| 1024x768p
| 1280x768p
| 1280x1024p
| 1360x768p
| 1400x1050p
| 1600x1200p
| 1680x1050p
| 1920x1200p
Select from HD and SD TV resolutions and common computer frame sizes. If the resolution you select does not match the resolution of the HDMI input source, the block returns an error.
Frame rate
— Rate at which consecutive images are displayed (frames per second)
24 fps
| 25 fps
| 30 fps
| 50 fps
| 60 fps
For most frame sizes, this parameter is informational. Frame size
576p
supports only 50 fps
.
Most other frame sizes support only 60 fps
, except for
720p
and 1080p
.
When you use frame sizes 720p
or
1080p
, you can select from the available frame
rates.
The block sets the Simulink sample time for the captured video frames to 1/Frame rate.
Pixel format
— Format of pixel stream
YCbCr 4:2:2
(default) | RGB
| Y only
Specify the format of the pixel stream as one of these values.
RGB
— Three 8 bit color components per pixel, which is 24 bits per pixel total. You can also select the color space conversion standard and whether the block returns a multidimensional signal or three separate color signals. For details, see the Use color space conversion specified by and Image signal parameters, respectively.Y only
— Grayscale. One 8 bit component per pixel. The block returns the frames on the Y output port.YCbCr 4:2:2
(default) — Also known as YUYV. An 8 bit Y component and an interleaved 8 bit CbCr component. The effective pixel size is 16 bits. The block returns the component frames on the Y, Cb, and Cr output ports.
The HDMI input video on the Zynq boards is delivered in YCbCr
4:2:2
format. Your configuration of the Video
Capture block sends control signals to the FPGA. The FPGA
logic converts the input and output data according to the pixel format
you specify.
Pixel Format | FPGA Logic Action |
---|---|
YCbCr 4:2:2 (YUYV) | Passes through. |
RGB | Converts HDMI input pixels from YCbCr 4:2:2 to RGB, and converts from RGB to YCbCr 4:2:2 for the HDMI output. |
Y only | Uses the Y component of HDMI input pixels in YCbCr 4:2:2, and outputs the Y component of YCbCr 4:2:2 for the HDMI output. |
Use color space conversion specified by
— Standard for conversion between RGB and YCbCr color spaces
Rec. 601 (SDTV)
(default) | Rec. 709 (HDTV)
This parameter specifies the equation that is used to convert between RGB and YCbCr color spaces. For more information, see the Color Space Conversion (Computer Vision Toolbox) block.
Dependencies
To enable this parameter, set Pixel format to
RGB
.
Bypass FPGA user logic
— Send input frames directly to HDMI output
off
(default) | on
Select this parameter to bypass the user logic section of the FPGA and send the input
video frames directly to the HDMI output. When you select this option, capture point
A
and B
observe the same video data.
Capture point
— Location of frames captured to processor
Input to FPGA user logic (A)
(default) | Output from FPGA user logic (B)
| No capture
You can import frames to Simulink from the input or output of the user logic section of the FPGA. This section of
logic is a pass-through in the default FPGA image. Generate HDL from your Simulink subsystem to insert into the user logic section of the FPGA. The data path
diagram in the Description section of this page shows the capture
points A
and B
.
Input to FPGA user logic (A)
— Capture frames after conversion and before the user logic section.Output from FPGA user logic (B)
— Capture frames after the user logic section and before conversion back to HDMI output.No capture
— No video data is passed to Simulink. You can still use the block to control the data path and video format on the FPGA.
Image signal
— RGB output stream format
Separate color signals
(default) | One multidimensional signal
Specify the RGB output stream format as one of these values.
Separate color signals
— The block returns separate height-by-width matrices for each color component. In this case, the block has R, G, and B output ports.One multidimensional signal
— The block returns a single 3-by-height-by-width matrix. In this case, the block has an Image output port.
Dependencies
To enable this parameter, set Pixel format to
RGB
.
Streaming interface
— Hardware implementation of pixel stream interface
Pixel-stream video
(default) | AXI4-stream video
This parameter is set to Pixel-stream video
and is read-only,
because the default FPGA image uses the Vision HDL Toolbox™ custom streaming interface. The signal protocol for this interface matches that
simulated in the Simulink model.
This parameter must match the implementation of the pixel-stream interface of the FPGA
image that is running on the board from which you are capturing data. To capture data from a
design that uses the AXI4-Stream Video interface, use your generated targeted hardware
interface model, where this parameter is set to AXI4-stream video
,
or copy the Video Capture block from that model.
If your FPGA image uses the Vision HDL Toolbox interface and you use the Video Capture block with this parameter set to
AXI4-stream video
, the model returns this error message.
command "/mnt/visionzynq-tools/visionzynq-target-dev.elf --write --device=/dev/mwipcore_vht2vs --address=0x00 0x01". Error evaluating 'StartFcn' callback of SubSystem block (mask) 'gm_vzImageRotation_PixelStream_tgthw_interface/Video Capture/VisionZynq Internal/FrameCapture_Init/Frame Format Check'. Callback string is 'visionzynq.internal.vzmask(gcb, 'FrameFormatCheckCb','StartFcn');' Caused by: Error executing command "/mnt/visionzynq-tools/visionzynq-target-dev.elf --write --device=/dev/mwipcore_vht2vs --address=0x00 0x01".
Pixel-stream video
, the block does not capture any data to the
model.
Version History
Introduced in R2016a
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)