imhistmatch - Adjust histogram of 2-D image to match histogram of reference image 테스트 영상 히스토그램을 reference영상 히스토그램으로 바꿔주는 함수
Matlab 2017. 7. 4. 18:50https://kr.mathworks.com/help/images/ref/imhistmatch.html
imhistmatch
Adjust histogram of 2-D image to match histogram of reference image
Syntax
B = imhistmatch(A,ref)B = imhistmatch(A,ref,nbins)[B,hgram] = imhistmatch(___)Description
transforms the 2-D grayscale or truecolor image B = imhistmatch(A,ref)A returning output image B whose histogram approximately matches the histogram of the reference image ref.
-
If both
Aandrefare truecolor RGB images,imhistmatchmatches each color channel ofAindependently to the corresponding color channel ofref. -
If
Ais a truecolor RGB image andrefis a grayscale image,imhistmatchmatches each channel ofAagainst the single histogram derived fromref. -
If
Ais a grayscale image,refmust also be a grayscale image.
Images A and ref can be any of the permissible data types and need not be equal in size.
uses B = imhistmatch(A,ref,nbins)nbins equally spaced bins within the appropriate range for the given image data type. The returned image B has no more than nbins discrete levels.
-
If the data type of the image is either
singleordouble, the histogram range is [0, 1]. -
If the data type of the image is
uint8, the histogram range is [0, 255]. -
If the data type of the image is
uint16, the histogram range is [0, 65535]. -
If the data type of the image is
int16, the histogram range is [-32768, 32767].
[ returns the histogram of the reference image B,hgram] = imhistmatch(___)ref used for matching in hgram. hgram is a 1-by-nbins (when ref is grayscale) or a 3-by-nbins (when ref is truecolor) matrix, where nbins is the number of histogram bins. Each row in hgram stores the histogram of a single color channel of ref.
Examples
Input Arguments
Output Arguments
Algorithms
The objective of imhistmatch is to transform image A such that the histogram of image B matches the histogram derived from image ref. It consists of nbins equally spaced bins which span the full range of the image data type. A consequence of matching histograms in this way is that nbins also represents the upper limit of the number of discrete data levels present in image B.
An important behavioral aspect of this algorithm to note is that as nbins increases in value, the degree of rapid fluctuations between adjacent populated peaks in the histogram of image B tends to increase. This can be seen in the following histogram plots taken from the 16–bit grayscale MRI example.

An optimal value for nbins represents a trade-off between more output levels (larger values of nbins) while minimizing peak fluctuations in the histogram (smaller values of nbins).
See Also
histeq | imadjust | imhist | imhistmatchn
'Matlab' 카테고리의 다른 글
| matlab code - convert face landmarks matlab .mat to .pts file (0) | 2018.06.07 |
|---|---|
| matlab audio read write (0) | 2017.12.20 |
| matlab figure 파일을 300dpi로 저장하는 법 - How can I save a figure to a TIFF image with resolution 300 dpi in MATLAB? (0) | 2017.03.27 |
| matlab TreeBagger 예제 나와있는 페이지 (0) | 2017.03.11 |
| MATLAB Treebagger and Random Forests (0) | 2017.03.11 |








