visionhdl.Histogram
Frequency distribution
Description
The visionhdl.Histogram
System object™ computes the frequency distribution of pixel values in a video stream. You can
configure the number and size of the bins. The object keeps a running histogram until you
clear the bin values and provides a read interface for accessing each bin.
To compute the frequency distribution of pixel values in a video stream:
Create the
visionhdl.Histogram
object and set its properties.Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?
Creation
Description
returns a
System object, histo
= visionhdl.Histogramhisto
, that computes image histograms over 256 bins.
Each bin value is 16 bits wide.
sets properties using one or more name-value pairs. Enclose each property name in single
quotes.histo
= visionhdl.Histogram(Name
,Value
)
Properties
Usage
Syntax
Description
histo(~,~,~,~)
performs an initial reset phase before processing
input data. After object creation or reset, call the object with dummy arguments for
NumBins
cycles before applying data. You do not have to set the
binreset
argument to 1
(true
)
during this phase.
[
adds the input pixel, dataout
,readrdy
,validout
] = histo(pixelin
,ctrlin
,~,0)pixelin
, to the internal histogram when the
input control signals, ctrl
indicate that the pixel is valid. Call
the object with this syntax for each pixel in a frame. The object returns
readrdy
set to 1
(true
) when
the histogram for the frame is complete. For this syntax, the object returns
dataout
set to 0
and
validout
set to 0
(false
).
This object uses a streaming pixel interface with a structure
for frame control signals. The interface enables the object to operate independently of image
size and format and connect with other Vision HDL Toolbox™ objects. The object accepts pixel data as integer, fixed-point, or floating-point
data types. The object accepts control signals as a structure containing five signals. The
control signals indicate the validity of each pixel and its location in the frame. To convert a
pixel matrix into a pixel stream and control signals, use the visionhdl.FrameToPixels
object. For a full description of the interface, see Streaming Pixel Interface.
[
reads the histogram bin specified by dataout
,readrdy
,validout
] = histo(~,~,binaddr
,0)binaddr
. Use this syntax after
the object returns readrdy
set to 1
(true
). Call the object with this syntax for each histogram bin.
After two further calls to the object (input arguments can change), the object returns
dataout
set to the bin value at binaddr
and
validout
set to 1
(true
).
[
resets the histogram values when dataout
,readrdy
,validout
] = histo(~,~,binaddr
,binreset
)binreset
is
1
(true
). You can initiate the reset while also
specifying a binaddr
to read. Before applying more video data,
complete the reset sequence by calling the object with dummy arguments for
NumBins
cycles.
To visualize the sequence of operations, see the timing diagrams in the Algorithms section of the Histogram block page.
Input Arguments
Output Arguments
Object Functions
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named obj
, use
this syntax:
release(obj)
Examples
Algorithms
This object implements the algorithms described in the Algorithms section of the Histogram block page.
Extended Capabilities
Version History
Introduced in R2015aSee Also
Histogram | imhist
(Image Processing Toolbox) | visionhdl.FrameToPixels