Skip to main content

ImageHistogram

ImageHistogram [/I/P=plane /R=roiWave /S] imageMatrix

ImageHistogram calculates the histogram of imageMatrix. When imageMatrix is a grayscale image, the histogram is stored in the wave W_ImageHist in the current data folder or as specified by the /DEST flag. If imageMatrix is a 3D RGB or RGBA wave, the resulting histograms for the color planes are saved in the waves W_ImageHistR, W_ImageHistG, W_ImageHistB or as specified by the flags /DSTR, /DSTG and /DSTB respectively.

imageMatrix must be a real-valued numeric wave.

Flags

/DEST=destWave
Specifies the output wave for a grayscale histogram. If this flag is not specified, the operation stores the histogram in the wave W_ImageHist in the current data folder.
When used in a function, ImageHistogram creates a real wave reference for destWave. See Automatic Creation of Wave References for details.
The waves specified as imageMatrix, roiWave and destWave must be distinct.
/DEST flag was added in Igor Pro 10.00.
/DSTR=destRWave
Specifies the red plane histogram wave for an RGB image. If this flag is not used, the operation stores the histogram in the wave W_ImageHistR in the current data folder.
When used in a function, ImageHistogram creates a real wave reference for destRWave. See Automatic Creation of Wave References for details.
The waves imageMatrix, roiWave, destRWave, destGWave and destBWave must all be distinct.
/DSTR flag was added in Igor Pro 10.00.
/DSTG=destGWave
Specifies the green plane histogram wave for an RGB image. If this flag is not used, the operation stores the histogram in the wave W_ImageHistG in the current data folder.
When used in a function, ImageHistogram creates a real wave reference for destGWave. See Automatic Creation of Wave References for details.
The waves specified as imageMatrix, roiWave, destRWave, destGWave and destBWave must all be distinct.
/DSTG flag was added in Igor Pro 10.00.
/DSTB=destBWave
Specifies the blue plane histogram wave for an RGB image. If this flag is not used, the operation stores the histogram in the wave W_ImageHistB in the current data folder.
When used in a function, ImageHistogram creates a real wave reference for destBWave. See Automatic Creation of Wave References for details.
The waves specified as imageMatrix, roiWave, destRWave, destGWave and destBWave must all be distinct.
/DSTB flag was added in Igor Pro 10.00.
/FREECreates all destination waves as free waves.
/FREE is allowed only in functions and only if the destination waves consist of a simple name or wave reference structure field.
See Free Waves for more discussion.
The /FREE flag was added in Igor Pro 10.00.
/ICalculates a histogram with 65536 bins evenly distributed between the minimum and the maximum data values. The operation first finds the extrema and then calculates the bins and the resulting histogram. Data can be a 2D wave of any type including float or double.
/P=planeRestricts the calculation of the histogram to a specific plane when imageMatrix is a non RGB 3D wave.
/R=roiWaveSpecifies a region of interest (ROI). The ROI is defined by a wave of type unsigned byte (/b/u) that has the same number of rows and columns as imageMatrix. The ROI itself is defined by the entries or pixels in the roiWave with value of 0. Pixels outside the ROI may have any nonzero value. The ROI does not have to be contiguous. When imageMatrix is a 3D wave, roiWave can be either a 2D wave (matching the number of rows and columns in imageMatrix ) or it can be a 3D wave that must have the same number of rows, columns and layers as imageMatrix. When using a 2D roiWave with a 3D imageMatrix the ROI is understood to be defined by roiWave for each layer in the 3D wave.
See ImageGenerateROIMask for more information on creating 2D ROI waves.
/SComputes the histogram for a whole 3D wave possibly subject to 2D or 3D ROI masking. The /S and /P flags are mutually exclusive.

Details

The ImageHistogram operation works on images, but it handles both 2D and 3D waves of any data type. Unless you use one of the special features of this operation (e.g., ROI or /P or /I) you could alternatively use the Histogram operation, which computes the histogram for the full wave and includes additional options for controlling the number of bins.

If the data type of imageMatrix is single byte, the histogram will have 256 bins from 0 to 255. Otherwise, the 256 bins will be distributed between the minimum and maximum values encountered in the data. Use the /I flag to increase the number of bins to 65536, which may be useful for unsigned short (/W/U) data.

See Also

Image Processing, Histograms

ImageHistModification, ImageGenerateROIMask

Histogram, JointHistogram