-
Notifications
You must be signed in to change notification settings - Fork 31
op calcHist
The FireSight calcHist stage generates a histogram for the current pipeline image. This stage is primarily diagnostic and provides only a subset of the functionality of OpenCV calcHist.
-
accumulate If true, bin values for separate channels will be summed. Default is
false
-
channels is a JSON vector of channel indexes. The default is
[]
, which will use all image channels. For an RGB image, this will be identical to[0 1 2]
. For a monochrome image, this will be identical to[0]
. The maximum number of channels in the array is 4. -
dims histogram dimensions. Default is
1
. At this time, only 1 dimension is supported. -
rangeMax maximum (exclusive)( value to use for range. Default is
256
-
rangeMin minimum (inclusive) value to use for range. Default is
0
The current FireSight implementation of calcHist only supports 1-dimensional histograms. Future implementations may support the full capability of OpenCV.
For single channel images or if accumulate is true, the histogram model is a sparse JSON object of integers:
{ "hist":{ "0":40751, "1":60157, ... "216":2 } }
For convenience, FireSight will generate one histogram for each channel of a color image if accumulate is false. The histogram values are combined into JSON arrays for each histogram bin:
{ "hist":{ "0":[28983,40751,35947], "1":[44643,60157,53446], ... "236":[0,0,1] } }
Example 1: multi-channel threshold histogram pipeline
firesight -i img/threshold64-color.png -p json/calcHist.json
Pixel:1.3ms
The input color image is the result of a [threshold](op threshold) pipeline →
The resulting calcHist model demonstrates that the threshold operation concentrated all pixel values for each channel into either 0 or 255:
{ "FireSight":{"version":"0.8.5","url":"https://github.com/firepick1/FireSight"}, "s1":{ "hist": {"0":[159711,159329,159260],"255":[289,671,740]} } }