Conversión de modelo de color (matlab)

RGB y HSV
cmap = rgb2hsv(M): El tamaño de la matriz es matriz m×3, y el valor de los elementos está entre [0, 1]. Las columnas de la matriz de entrada M representan las intensidades de rojo, verde y azul, respectivamente, y las columnas de la matriz de salida cmap representan el tono, la saturación y la luminosidad, respectivamente.
hsv_imagen = rgb2hsv(rgb_imagen)
rgb_imagen = hsv2rgb(hsv_imagen)

%拆分HSV
>> RGB = reshape(ones(64,1)*reshape(jet(64),1,192),[64,64,3]);%调整颜色色条尺寸为正方形
>> HSV = rgb2hsv(RGB);
>> H = HSV(:,:,1);
>> S = HSV(:,:,2);
>> V = HSV(:,:,3);
>> figure,
>> subplot(221),imshow(H),title('H');
>> subplot(222),imshow(S),title('S');
>> subplot(223),imshow(V),title('V');
>> subplot(224),imshow(RGB),title('RGB');

inserte la descripción de la imagen aquí

>> RGB = imread("E:\persional\matlab\images\ad1.tif");
>> HSV = rgb2hsv(RGB);
>> figure,
>> subplot(121),imshow(RGB),title('RGB');
>> subplot(122),imshow(HSV),title('HSV');

inserte la descripción de la imagen aquí
RGB y YCbCr
ycbcrmap = rgb2ycbcr(mapa): Asigne el color del espacio RGB al espacio YCbCr. map es una matriz de m × 3, y ycbcrmap también es una matriz de m × 3. La matriz representa el brillo Y y dos tipos de diferencias de color Cb y Cr respectivamente. Cada línea de ycbcrmap representa el mapa de color del espacio RGB de la fila correspondiente al color equivalente.
YCBCR = rgb2ycbcr(RGB): convierte la imagen de color RGB en la imagen de espacio YCbCr correspondiente, RGB debe ser una matriz de m × n × 3.
rgbmap = ycbcr2rgb(ycbcrmap)
Imagen_RGB = ycbcr2rgb(ycbcr_imagen)

>> RGB = imread("E:\persional\matlab\images\ad1.tif");
>> ycbcr = rgb2ycbcr(RGB);
>> figure,
>> subplot(121),imshow(RGB),title('RGB');
>> subplot(122),imshow(ycbcr),title('ycbcr');

inserte la descripción de la imagen aquí

Guess you like

Origin blog.csdn.net/weixin_56260304/article/details/127738997