HIST_SPEC_CVIP
hist_spec_cvip() - Hisotogram specification of an input image.
Contents
SYNTAX
[ outImage ] = hist_spec_cvip( inImage, histFunc, A, B)
Input Parameters include :
- inImage - Input image of PxQ or PxQxN size. The input image can be of uint8 or uint16 or double class.
- histFunc - Function to specify histogram per each band. The inputs to the functions have the expression Ax+B. Where x is gray values, and A & B are constants. histFunc(1): specified histogram of band 1 histFunc(2): specified histogram of band 2 . . . histFunc(N): specified histogram of band N ([1 1 1] | default)
- A - Values of constant A of expression Ax+B. A(1): value of constant A for band 1 A(2): value of constant A for band 2 . . . A(N): value of constant A for band N ([1 1 1] | default)
- B - Values of constant B of expression Ax+B. B(1): value of constant B for band 1 B(2): value of constant B for band 2 . . . B(N): value of constant B for band N ([0 0 0] | default)
Output Parameter includes :
- outImage - Histogram specified image.
DESCRIPTION
The function performs a histogram specification on an image. For single or multi-band images, the histograms can be specified separately for each band. The specified histogram is computed by calculating the cumulative distribution function of both the original histogram and the desired histogram. The cdf for the original histogram is then mapped to the desired histogram using the inverse cdf. If Pr(x) is the original histogram, and Pz(x) is the desired histogram, then the cdf[Pr(x)] = T(r) = s, and cdf[Pz(x)] = G(z) = v. The inverse of this is z = inv[G(v)]. Therefore z = inv[G(T(r))]. Where r is the original gray-level, and z is the new gray-level.
REFERENCE
1.Scott E Umbaugh. DIGITAL IMAGE PROCESSING AND ANALYSIS: Applications with MATLAB and CVIPtools, 3rd Edition.
EXAMPLE
% Read image I = imread('butterfly.tif'); % calling function with default parameters. O1 = hist_spec_cvip(I); % calling function with user defined parameters. O2 = hist_spec_cvip(I,[1 2 4], [0.025 1 0.03], [1 0.5 1]); % Display input image figure;imshow(I);title('Input Image'); % Dispaly output images figure; imshow(O1/255);title('Output Image with default parameters'); figure; imshow(O2/255);title('Output Image with user defined parameters');
CREDITS
Author: Norsang Lama, March 2017
Copyright © 2017-2018 Scott
E Umbaugh
For updates visit CVIP Toolbox Website