vision.BinaryFileReader System object

Package: vision

Read video data from binary files

Description

The BinaryFileReader object reads video data from binary files.

Construction

H = vision.BinaryFileReader returns a System object, H, that reads binary video data from the specified file in I420 Four Character Code (FOURCC) video format.

H = vision.BinaryFileReader(Name,Value) returns a binary file reader System object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1, Value1,...,NameN,ValueN).

H = vision.BinaryFileReader(FILE,Name,Value) returns a binary file reader System object, H, with the Filename property set to FILE and other specified properties set to the specified values.

Properties

Filename

Name of binary file to read from

Specify the name of the binary file as a string. The full path for the file needs to be specified only if the file is not on the MATLAB® path. The default is vipmen.bin.

VideoFormat

Format of binary video data

Specify the format of the binary video data as Four character codes, or Custom. The default is Four character codes.

FourCharacterCode

Four Character Code video format

Specify the binary file format from the available list of Four Character Code video formats. For more information on Four Character Codes, see http://www.fourcc.org. This property applies when you set the VideoFormat property to Four character codes.

BitstreamFormat

Format of data as planar or packed

Specify the data format as Planar or Packed. This property applies when you set the VideoFormat property to Custom. The default is Planar.

OutputSize

Size of output matrix

Specify the size of the output matrix. This property applies when you set the BitstreamFormat property to Packed.

VideoComponentCount

Number of video components in video stream

Specify the number of video components in the video stream as 1, 2, 3 or 4. This number corresponds to the number of video component outputs. This property applies when you set the VideoFormat property to Custom. The default is 3.

VideoComponentBits

Bit size of video components

Specify the bit sizes of video components as an integer valued vector of length N, where N is the value of the VideoComponentCount property. This property applies when you set the VideoFormat property to Custom. The default is [8 8 8].

VideoComponentSizes

Size of output matrix

Specify the size of the output matrix. This property must be set to an N-by-2 array, where N is the value of the VideoComponentCount property. Each row of the matrix corresponds to the size of that video component, with the first element denoting the number of rows and the second element denoting the number of columns. This property applies when you set the VideoFormat property to Custom and the BitstreamFormat property to Planar. The default is [120 160; 60 80; 60 80].

VideoComponentOrder

Specify how to arrange the components in the binary file. This property must be set to a vector of length N, where N is set according to how you set the BitstreamFormat property. When you set the BitStreamFormat property to Planar, you must set N equal to the value of the VideoComponentCount property. Otherwise, you can set N equal to or greater than the value of the VideoComponentCount property.

This property applies when you set the VideoFormat property to Custom. The default is [1 2 3].

InterlacedVideo

Whether data stream represents interlaced video

Set this property to true if the video stream represents interlaced video data. This property applies when you set the VideoFormat property to Custom. The default is false.

LineOrder

How to fill binary file

Specify how to fill the binary file as Top line first, or Bottom line first. If this property is set to Top line first, the System object first fills the binary file with the first row of the video frame. If it is set to Bottom line first, the System object first fills the binary file with the last row of the video frame. The default is Top line first.

SignedData

Whether input data is signed

Set this property to true if the input data is signed. This property applies when you set the VideoFormat property to Custom. The default is false.

ByteOrder

Byte ordering as little endian or big endian

Specify the byte ordering in the output binary file as Little endian, Big endian. This property applies when you set the VideoFormat property to Custom. The default is Little endian.

PlayCount

Number of times to play the file

Specify the number of times to play the file as a positive integer or inf. The default is 1.

Methods

cloneCreate binary file reader object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isDoneEnd-of-file status (logical)
isLockedLocked status for input attributes and nontunable properties
release Allow property value and input characteristics changes
resetReset to beginning of file
stepRead video components from a binary file

Examples

Read in a binary video file and play it back on the screen

 hbfr = vision.BinaryFileReader('ecolicells.bin');
 hbfr.VideoFormat = 'Custom';
 hbfr.VideoComponentCount = 1;
 hbfr.VideoComponentBits = 16; 
 hbfr.VideoComponentSizes = [442 538];
 hbfr.VideoComponentOrder = 1;
 
 hvp = vision.VideoPlayer;
 while ~isDone(hbfr)
   y = step(hbfr);
   step(hvp,y);
 end

 release(hbfr); % close the input file
 release(hvp); % close the video display 

Algorithms

This object implements the algorithm, inputs, and outputs described on the Read Binary File block reference page. The object properties correspond to the block parameters.

Was this topic helpful?