How to separate RGB values of an image.
古いコメントを表示
We know that each pixel i in the input image I has rgb colors. My question is how to store them in a 3-vector Ii. Each color is being represented using a 64-bit floating-point number scaled to between 0 and 1.
採用された回答
その他の回答 (3 件)
Sailesh Sidhwani
2018 年 10 月 25 日
編集済み: Sailesh Sidhwani
2020 年 9 月 3 日
1 投票
Starting R2018b, Image Processing Toolbox has a new function "imsplit" which does exactly this: https://www.mathworks.com/help/images/ref/imsplit.html
Sean de Wolski
2011 年 2 月 1 日
Rchannel = I(:,:,1);
Gchannel = I(:,:,2);
Bchannel = I(:,:,3);
2 件のコメント
Abinaya
2014 年 5 月 6 日
can you pls explain that 1 2 3 in each channel.
Walter Roberson
2018 年 10 月 25 日
It is by definition: MATLAB interprets the first pane of the third dimension as being red values, the second pane of the third dimension as being green values, the third pane of the third dimension as being blue values.
That particular ordering is arbitrary: there is no reason why it could not have been Green, Red, Blue for example, which would have made some sense in terms of the sensitivity of the human eye to brightness in daylight. Or it could have been Blue that was first, reflecting the fact that the human eye is most sensitive to contrast in the blues. But for whatever reason, RGB was the order standardized on.
Sean de Wolski
2011 年 2 月 1 日
You could also do it so you have a cell array with each index being a 3x1 vector, perhaps:
I2 = cellfun(@squeeze,num2cell(I,3),'uni',false);
カテゴリ
ヘルプ センター および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!