Read Binary File
Read video data from binary file
Libraries:
Computer Vision Toolbox /
Sinks
Description
The Read Binary File block reads the video data from a binary file and imports it into a Simulink® model.
The user-specified block parameters describe the format of the video data. These parameters, along with the raw binary file, create the video data for the Simulink model.
Note
This block supports code generation for only those platforms that have file I/O. The block does not support code generation using Simulink Desktop Real-Time™ or Simulink Real-Time™.
Examples
Read Video Stored as Binary Data
Read a video data stored in binary format by using the Read
Binary
File
block.
Ports
Output
Luminance component of the video read from the binary file, specified as a 3-D
array. The label of this port can be changed using the Component1
parameter when the Video format parameter is set to
Custom
.
Data Types: int8
| int16
| int32
| uint8
| uint16
| uint32
Blue difference component of the video read from the binary file, specified as a
3-D array. The label of this port can be changed using the
Component2 parameter when the Video format
parameter is set to Custom
.
Data Types: int8
| int16
| int32
| uint8
| uint16
| uint32
Red difference component of the video read from the binary file, specified as a
3-D array. The label of this port can be changed using the
Component3 parameter when the Video format
parameter is set to Custom
.
Data Types: int8
| int16
| int32
| uint8
| uint16
| uint32
Alpha component of the video read from the binary file, specified as a 3-D array.
The label of this port can be changed using the Component4
parameter when the Video format parameter is set to
Custom
.
Dependencies
To enable this port, use one of these options.
Set the Video format parameter to
Four character codes
and set the Four character code parameter toAYUV
orIF09
.Set the Video format parameter to
Custom
and the Number of output components parameter to4
.
Data Types: int8
| int16
| int32
| uint8
| uint16
| uint32
Transparency component of the video read from the binary file, specified as a 3-D array.
Dependencies
To enable this port, set the Video format parameter to
Four character codes
and set the Four
character code parameter to Y41T
or
Y42T
.
Data Types: int8
| int16
| int32
| uint8
| uint16
| uint32
The port outputs a 1
when the component ports output the last
video frame. For every frame before that, it outputs a 0
.
Dependencies
To enable this port, select the Output end-of-file indicator parameter.
Data Types: Boolean
Parameters
Specify the name of the binary source file to read video data from.
Specify the format of the video data as one of these options.
Four character codes (FOURCC) — For more information about these codes, see
https://en.wikipedia.org/wiki/FourCC
.Custom — Read the video data from a binary file of a custom format.
Specify the four character code of the binary file codec. The value of this parameter also sets the number of output ports. For information on which four character codes enable which output ports, see the table below.
Output Ports for Four Character Codes
Four Character Codes | Output Ports |
---|---|
I420 | Y'|Cb|Cr |
AYUV | Y'|Cb|Cr|A |
CLJR | Y'|Cb|Cr |
cyuv | Y'|Cb|Cr |
GREY | Y' |
IF09 | Y'|Cb|Cr|A |
IMC1 | Y'|Cb|Cr |
IMC2 | Y'|Cb|Cr |
IMC3 | Y'|Cb|Cr |
IMC4 | Y'|Cb|Cr |
IUYV | Y'|Cb|Cr |
IY41 | Y'|Cb|Cr |
IYU1 | Y'|Cb|Cr |
IYU2 | Y'|Cb|Cr |
IYUV | Y'|Cb|Cr |
NV12 | Y'|Cb|Cr |
NV21 | Y'|Cb|Cr |
UYNV | Y'|Cb|Cr |
UYNY | Y'|Cb|Cr |
V210 | Y'|Cb|Cr |
Y411 | Y'|Cb|Cr |
Y41P | Y'|Cb|Cr |
Y41T | Y'|Cb|Cr|T |
Y422 | Y'|Cb|Cr |
Y42T | Y'|Cb|Cr|T |
Y8 | Y' |
Y800 | Y' |
YUNV | Y'|Cb|Cr |
YUY2 | Y'|Cb|Cr |
YUYV | Y'|Cb|Cr |
YV12 | Y'|Cb|Cr |
YV16 | Y'|Cb|Cr |
YVU9 | Y'|Cb|Cr |
YVYU | Y'|Cb|Cr |
Dependencies
To enable this parameter, set the Video format parameter to
Four character codes
.
Specify the number of rows in the output array as a positive integer. The value of this parameter must match the dimensions of the data inside the file.
Dependencies
To enable this parameter, set the Video format parameter to
Four character codes
.
Specify the number of columns in the output array as a positive integer. The value of this parameter must match the dimensions of the data inside the file.
Dependencies
To enable this parameter, set the Video format parameter to
Four character codes
.
If you select Top line first
, the block first fills the first row
of the output array with the corresponding contents of the binary file. It then fills
the other rows in increasing order. When you select Bottom line
first
, the block first fills the last row of the output array with the
corresponding contents of the binary file. It then fills the other rows in decreasing
order.
Specify the number of times to repeat the binary file as a positive integer or
inf
. For any positive integer value n
of this
parameter, the block plays the binary file n
times. For a value of
inf
, the block plays the file indefinitely until the end of
simulation.
This parameter indicates when the block output reaches the last video frame in the
binary file. Selecting this parameter enables the EOF port. The
output from the EOF port is 1
when the block
output reaches the last video frame. For all other frames, it is
0
.
Specify the sample period of the output. Sample time indicates when, during
simulation the block produces output. The value of this parameter must be a positive
scalar less than the simulation time or -1
. It cannot be
0
. When set to -1
, the block inherits the sample
time from the simulink model.
Specify the data format of the binary file as planar or packed. If the data is packed, use the FrameSize Rows and FrameSize Cols parameters to define the size of the output array.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
.
Specify the number of output components from the binary file. This parameter sets the number of output ports.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
.
Specify the name for the luminance component of the output array. The luminance component is the first component from the input binary file.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, set the Number of output
components parameter to 1
or greater.
Specify the name for the blue difference component of the output array. The blue difference component is the second component from the input binary file.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, set the Number of output
components parameter to 2
or greater.
Specify the name for the red difference component of the output array using this parameter. The red difference component is the third component from the input binary file.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, set the Number of output
components parameter to 3
or greater.
Specify the name for the alpha component of the output array. The alpha component is the fourth component from the input binary file.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, set the Number of output
components parameter to 4
.
Specify the size of the luminance component in the output array. The value of this
parameter determines the interpretation of the video stream data as
8
-bit, 16
-bit, 24
-bit, or
32
-bit.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, and set the Number of output
components parameter to 1
or greater.
Specify the size of the blue difference component in the output array. The value of
this parameter determines the interpretation of the video stream data as
8
-bit, 16
-bit, 24
-bit, or
32
-bit.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, and set the Number of output
components parameter to 2
or greater.
Specify the size of the red difference component in the output array. The value of
this parameter determines the interpretation of the video stream data as
8
-bit, 16
-bit, 24
-bit, or
32
-bit.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, and set the Number of output
components parameter to 3
or greater.
Specify the size of the alpha component in the output array. The value of this
parameter determines the interpretation of the video stream data as
8
-bit, 16
-bit, 24
-bit, or
32
-bit.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, and set the Number of output
components parameter to 4
.
Specify the number of rows for the luminance component in the output array. The value of this parameter must be a positive integer.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, and set the Number of output
components parameter to 1
or greater.
Specify the number of rows for the blue difference component in the output array. The value of this parameter must be a positive integer.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, and set the Number of output
components parameter to 2
or greater.
Specify the number of rows for the red difference component in the output array. The value of this parameter must be a positive integer.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, and set the Number of output
components parameter to 3
or greater.
Specify the number of rows for the alpha component in the output array. The value of this parameter must be a positive integer.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, and set the Number of output
ports parameter to 4
.
Specify the number of columns for the luminance component in the output array. The value of this parameter must be a positive integer.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, and set the Number of output
components parameter to 1
or greater.
Specify the number of columns for the blue difference component in the output array. The value of this parameter must be a positive integer.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, and set the Number of output
components parameter to 2
or greater.
Specify the number of columns for the luminance component in the output array. The value of this parameter must be a positive integer.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, and set the Number of output
components parameter to 3
or greater.
Specify the number of columns for the alpha component in the output array. The value of this parameter must be a positive integer.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
, and set the Number of output
components parameter to 4
.
Specify the arrangement of components in the binary file. Identify the components by the assigned numerals, from 1 to 4, in desired order. You must include all the enabled components when setting this parameter.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
.
Select this parameter when the binary file contains interlaced video data.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
.
Select this parameter when the binary file contains signed integers.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
.
Specify the byte order of the binary file as either little endian or big endian.
Dependencies
To enable this parameter, set the Video format parameter to
Custom
.
Block Characteristics
Data Types |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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: United States.
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)