i want to convert an image from rgb to xyz and want to get the values of x and y and z separately. so i am having a problem. how can i encounter the problem?????
3 ビュー (過去 30 日間)
古いコメントを表示
RGB = [255; 255; 255 ];
rRGB=RGB(:,:,1);
gRGB=(RGB(:,:,2)./RGB(2)) * 100;
bRGB=RGB(:,:,3);
M = [0.4124564 0.3575761 0.1804375
0.2126729 0.7151522 0.0721750
0.0193339 0.1191920 0.9503041] ;
X = rRGB * 0.4124564 + gRGB * 0.2126729 + bRGB* 0.0193339;
Y = rRGB * 0.3575761 + gRGB * 0.7151522 + bRGB* 0.1191920;
Z= rRGB * 0.0193339 + gRGB * 0.1191920 + bRGB* 0.9503041 ;
so when i am running the programme i am getting this error
??? Index exceeds matrix dimensions.
Error in ==> pd at 3 gRGB=RGB(:,:,2)./RGB(2);
by d way when i am putting RGB=imread('F:\47.jpg', 'jpg') then i m getting a result..... what is the problem in the code???
1 件のコメント
回答 (1 件)
Guillaume
2014 年 11 月 20 日
Your RGB is a 3x1x1 matrix. There's only one valid value for the index in the third dimension (1), so
RGB(:, :, 2)
RGB(:, :, 3)
are both invalid.
Probably, you meant to declare RGB as
RGB(1, 1, :) = [255 255 255];
参考
カテゴリ
Help Center および File Exchange で Blue についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!