Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
matlab中的色彩自适应_Matlab_Image Processing - Fatal编程技术网

matlab中的色彩自适应

matlab中的色彩自适应,matlab,image-processing,Matlab,Image Processing,我想把这些灰色图像转换成彩色图像,这样我就可以观察颜色的变化 另一件事是如何将Bradford变换应用于图像(以便将图像与Bradford矩阵相乘) Mbfd = [.8950 .2664 -.1614; -.7502 1.7135 .0367; .0389 -.0685 1.0296]) 我知道我必须将输入图像与Bradford矩阵相乘,但我不知道如何准确地做到这一点 I=imread('snimka.jpeg'); figure(1), imshow(I);

我想把这些灰色图像转换成彩色图像,这样我就可以观察颜色的变化

另一件事是如何将Bradford变换应用于图像(以便将图像与Bradford矩阵相乘)

 Mbfd = [.8950 .2664 -.1614;
       -.7502 1.7135 .0367;
       .0389 -.0685 1.0296])
我知道我必须将输入图像与Bradford矩阵相乘,但我不知道如何准确地做到这一点

I=imread('snimka.jpeg');
figure(1), imshow(I);
srgb2lab_byA = makecform('srgb2lab', 'AdaptedWhitePoint',whitepoint('a')); 
srgb2lab_byD50 = makecform('srgb2lab', 'AdaptedWhitePoint',whitepoint('d50'));
srgb2lab_byD55 = makecform('srgb2lab', 'AdaptedWhitePoint',whitepoint('d55'));
srgb2lab_byD65 = makecform('srgb2lab', 'AdaptedWhitePoint',whitepoint('d65'));
lab_A = applycform(I,srgb2lab_byA); 
lab_D50 = applycform(I,srgb2lab_byD50); 
lab_D55 = applycform(I,srgb2lab_byD55); 
lab_D65 = applycform(I,srgb2lab_byD65); 

% figure;
figure();
subplot(2,2,1), imshow(lab_A(:,:,1)); title('sRGB to Lab by adapting to illuminant A'); 
subplot(2,2,2), imhist(lab_A(:,:,1)); title('Histogram of the red channel');
subplot(2,2,3), imhist(lab_A(:,:,2)); title('Histogram of the green channel');
subplot(2,2,4), imhist(lab_A(:,:,3)); title('Histogram of the blue channel');
figure();
subplot(2,2,1), imshow(lab_D50(:,:,1)); title('sRGB to Lab by adapting to illuminant D50');
subplot(2,2,2), imhist(lab_D50(:,:,1)); title('Histogram of the red channel');
subplot(2,2,3), imhist(lab_D50(:,:,2)); title('Histogram of the green channel');
subplot(2,2,4), imhist(lab_D50(:,:,3)); title('Histogram of the blue channel');
% luminance_diff=abs(lab_A(:,:,1)-lab_D50(:,:,1));
figure();
subplot(2,2,1), imshow(lab_D55(:,:,1)); title('sRGB to Lab by adapting to illuminant D55');
subplot(2,2,2), imhist(lab_D55(:,:,1)); title('Histogram of the red channel');
subplot(2,2,3), imhist(lab_D55(:,:,2)); title('Histogram of the green channel');
subplot(2,2,4), imhist(lab_D55(:,:,3)); title('Histogram of the blue channel');
figure();
subplot(2,2,1), imshow(lab_D65(:,:,1)); title('sRGB to Lab by adapting to illuminant D65');
subplot(2,2,2), imhist(lab_D65(:,:,1)); title('Histogram of the red channel');
subplot(2,2,3), imhist(lab_D65(:,:,2)); title('Histogram of the green channel');
subplot(2,2,4), imhist(lab_D65(:,:,3)); title('Histogram of the blue channel');

您无法从灰色图像生成彩色图像。灰色图像的信息较少,无法从灰色图像获取颜色。但是,您的图像显示为清晰的RGB。您显示的代码显示灰度的原因是,您仅显示图像的一个通道(R、G、B)。
imshow(I)
将向您显示图像

要显示操作产生的结果,您需要再次将其转换为rgb。假设您希望看到白电平更改:

torgb= makecform('lab2srgb'); 
Irgb=applycform(lab_D55,torgb);
imshow(Irgb);
要将您提到的矩阵应用于图像,请对其进行过滤:

Mbfd = [.8950 .2664 -.1614; -.7502 1.7135 .0367; .0389 -.0685 1.0296]);
out=imfilter(I, Mbfd);


总的来说,你的问题暗示你缺乏理解。我建议你阅读RGB和Lab是什么,以及白色水平是什么。也要阅读灰度图像与彩色图像的区别。这对你将来会有很大帮助。

你不能从灰色图像生成彩色图像。灰色图像的信息较少,无法获得彩色图像om灰色图像。但是,您的图像显示为清晰的RGB。您显示的代码显示灰度的原因是因为您仅显示图像的一个通道(R、G、B)。
imshow(I)
将显示图像

要显示操作产生的结果,您需要再次将其转换为rgb。假设您希望看到白电平更改:

torgb= makecform('lab2srgb'); 
Irgb=applycform(lab_D55,torgb);
imshow(Irgb);
要将您提到的矩阵应用于图像,请对其进行过滤:

Mbfd = [.8950 .2664 -.1614; -.7502 1.7135 .0367; .0389 -.0685 1.0296]);
out=imfilter(I, Mbfd);

总的来说,你的问题暗示你缺乏理解。我建议你阅读什么是RGB和Lab以及白色级别的作用。也阅读什么是灰度图像与彩色图像。这将在未来对你有很大帮助