need to extract rgb value of image in the format [r g b]
古いコメントを表示
i need to extract rgb value of any image in the format of [R G B]. I am using getimage() but I am getting error
??? Error using ==> getimage>parseInputs at 217 GETIMAGE: Invalid handle H.
Error in ==> getimage at 86 him = parseInputs(varargin{:});
please suggest.
採用された回答
その他の回答 (1 件)
Teja Muppirala
2011 年 5 月 5 日
If you have a RGB image that is [m x n x 3], you can use the RESHAPE command to give you the columns as [r g b]:
I = imread('peppers.png'); % Read in a sample image
size(I)
I2 = reshape(I,[],3);
size(I2)
Now I2 is of the form [R G B] and has size [(m x n) 3]
1 件のコメント
Teja Muppirala
2011 年 5 月 5 日
By the way, when you were using GETIMAGE, where you perhaps trying to do something like this?
getimage('somefile.jpg')
This is not correct. The GETIMAGE command is not for reading in files, and so you will get an error if you try this. As you stated, IMREAD is the correct command.
カテゴリ
ヘルプ センター および File Exchange で Convert Image Type についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!