フィルターのクリア

Apply the "color range" of one grayscale image to another graysacle image

1 回表示 (過去 30 日間)
John Kau
John Kau 2015 年 7 月 24 日
コメント済み: John Kau 2015 年 7 月 25 日
Hi,
I have 2 grayscale images, A and B. A consits of only 8 colors (122 to 129) and B consits of 131 colors (20 to 150).
I would like to apply image A's color range to image B while keeping B's "original relative color range".
Any idea of how to do this?
Many thanks! jk

採用された回答

Image Analyst
Image Analyst 2015 年 7 月 24 日
If you want to squeeze the B image into the range of the A image, you can use imhistmatch(), mat2gray(), or imadjust(), or even simple mathematical scaling manually. For example
minA = min(A(:));
maxA = max(A(:));
newB = (maxA - minA) * mat2gray(double(B)) + minA;
imshow(newB, []); % The [] are needed if you want to see it.
newB is a floating point image. Cast back to uint8 if you want but if you do that, you'll have quantization error.

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by