Read binary video data from files
Sources
visionsources
The Read Binary File block reads video data from a binary file and imports it into a Simulink® model.
This block takes user specified parameters that describe the format of the video data. These parameters together with the raw binary file, which stores only raw pixel values, creates the video data signal for a Simulink model. The video data read by this block must be stored in row major format.
This block supports code generation only for platforms that have file I/O available. You cannot use this block to do code generation with Simulink Desktop Real-Time™ or Simulink Real-Time™.
Port | Output | Supported Data Types | Complex Values Supported |
---|---|---|---|
Output | Scalar, vector, or matrix of integer values |
| No |
EOF | Scalar value | Boolean | No |
Four Character Codes (FOURCC) identify video formats. For more information about these codes,
see https://www.fourcc.org
.
Use the Four character code parameter to identify the binary file format. Then, use the Rows and Cols parameters to define the size of the output matrix. These dimensions should match the matrix dimensions of the data inside the file.
If your binary file contains data that is not in FOURCC format, you can configure the Read Binary File block to understand a custom format:
Use the Bit stream format parameter to specify whether your data is planar or packed. If your data is packed, use the Rows and Cols parameters to define the size of the output matrix.
Use the Number of output components parameter to specify the number of components in the binary file. This number corresponds to the number of block output ports.
Use the Component, Bits, Rows, and Cols parameters to specify the component name, bit size, and size of the output matrices, respectively. The block uses the Component parameter to label the output ports.
Use the Component order in binary file parameter to specify how the components are arranged within the file.
Select the Interlaced video check box if the binary file contains interlaced video data.
Select the Input file has signed data check box if the binary file contains signed integers.
Use the Byte order in binary file to indicate whether your binary file has little endian or big endian byte ordering.
Specify the name of the binary file to read. If the location of this file is on your MATLAB® path, enter the filename. If the location of this file is not on your MATLAB path, use the Browse button to specify the full path to the file as well as the filename.
Specify the format of the binary video data. Your choices are Four
character codes
or Custom
.
See Four Character Code Video Formats or Custom Video Formats for more details.
From the drop-down list, select the binary file format.
Define the size of the output matrix. These dimensions should match the matrix dimensions of the data inside the file.
Specify how the block fills the output matrix.If you select Top
line first
, the block first fills the first row of the
output matrix with the contents of the binary file. It then fills
the other rows in increasing order. If you select Bottom
line first
, the block first fills the last row of the
output matrix. It then fills the other rows in decreasing order.
Specify the number of times to play the file. The number you enter must be
a positive integer or inf
, to play the file until you
stop the simulation.
Specifies the output is the last video frame in the binary file. When you select this check box, a Boolean output port labeled EOF appears on the block. The output from the EOF port is 1 when the last video frame in the binary file is output from the block. Otherwise, the output from the EOF port is 0.
Specify the sample period of the output signal.
Specify whether your data is planar or packed.
Define the size of the output matrix. This parameter appears
when you select a Bit stream format parameter
of Packed
.
Specify the number of components in the binary file.
Specify the component name, bit size, and size of the output matrices, respectively.
Specify the order in which the components appear in the binary file.
Select this check box if the binary file contains interlaced video data.
Select this check box if the binary file contains signed integers.
Use this parameter to indicate whether your binary file has little endian or big endian byte ordering.
Computer Vision Toolbox™ | |
Computer Vision Toolbox |