Documentation Center

  • Trial Software
  • Product Updates

Read Binary File

Read binary video data from files

Library

Sources

visionsources

Description

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.

    Note:   This block supports code generation only for platforms that have file I/O available. You cannot use this block to do code generation with Real-Time Windows Target™ (RTWin).

PortOutputSupported Data TypesComplex Values Supported

Output

Scalar, vector, or matrix of integer values

  • 8-, 16- 32-bit signed integer

  • 8-, 16- 32-bit unsigned integer

No

EOF

Scalar value

Boolean

No

Four Character Code Video Formats

Four Character Codes (FOURCC) identify video formats. For more information about these codes, see http://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.

Custom Video Formats

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.

Dialog Box

The Read Binary File dialog box appears as shown in the following figure.

File name

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.

Video format

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.

Four character code

From the drop-down list, select the binary file format.

Frame size: Rows, Cols

Define the size of the output matrix. These dimensions should match the matrix dimensions of the data inside the file.

Line ordering

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.

Number of times to play file

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.

Output end-of-file indicator

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.

Sample time

Specify the sample period of the output signal.

Bit stream format

Specify whether your data is planar or packed.

Frame size: Rows, Cols

Define the size of the output matrix. This parameter appears when you select a Bit stream format parameter of Packed.

Number of output components

Specify the number of components in the binary file.

Component, Bits, Rows, Cols

Specify the component name, bit size, and size of the output matrices, respectively.

Component order in binary file

Specify the order in which the components appear in the binary file.

Interlaced video

Select this check box if the binary file contains interlaced video data.

Input file has signed data

Select this check box if the binary file contains signed integers.

Byte order in binary file

Use this parameter to indicate whether your binary file has little endian or big endian byte ordering.

See Also

From Multimedia File

Computer Vision System Toolbox™

Write Binary File

Computer Vision System Toolbox

Was this topic helpful?