Normalization Of color spaces

40 ビュー (過去 30 日間)
Medical Imaging
Medical Imaging 2015 年 6 月 17 日
回答済み: Image Analyst 2015 年 6 月 17 日
I have written a code for color space conversion from RGB to HSV,Lab,YCbCr,XYZ,CMYK and YUV. Now in next step I want to normalize each band of color space. How can I do it?

採用された回答

Image Analyst
Image Analyst 2015 年 6 月 17 日
Use mat2gray to normalize any array to the range 0-1. For example:
H = rand(4,3) % Sample data for Hue image
normH = mat2gray(H)
In the command window, notice how normH goes from 0-1.
H =
0.6787 0.6555 0.2769
0.7577 0.1712 0.0462
0.7431 0.7060 0.0971
0.3922 0.0318 0.8235
normH =
0.8172 0.7878 0.3096
0.9170 0.1760 0.0181
0.8985 0.8517 0.0825
0.4553 0 1.0000

その他の回答 (1 件)

Christiaan
Christiaan 2015 年 6 月 17 日
Dear Sir,
If I understand you correctly, you want to normalise a color map. Therefore you may could use this code (as an example):
clc;clear all;close all;
c_map = colormap(winter); close;
x = 0.9; % color map is normalised from x = 0 to 1
c_map_picked = c_map(round((length(c_map)-1)*x+1),:)
x = linspace(0,2*pi,100);
y = sin(x);
line(x,y,'Color',c_map_picked); hold on;
Kind regards, Christiaan

Community Treasure Hunt

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

Start Hunting!

Translated by