how to transfer image pixel values into array
古いコメントを表示
transfer image pixel values into array for complete image
- array(,1)=R value
- array(,2)=G value
- array(,3)=B value
- array(,4)=x position
- array(,5)= y position
1 件のコメント
David Young
2014 年 2 月 20 日
The question does not make sense. array(,1) is not valid syntax - there needs to be something in front of the comma. Also, what are you transferring the values from?
採用された回答
その他の回答 (1 件)
Adam
2014 年 2 月 20 日
If you mean array(:,1) = R value, then:
if true
myImage = imread('myFile.img');
array(:,1) = reshape(myImage(:,:,1),[],1); %red
array(:,2) = reshape(myImage(:,:,2),[],1); %green
array(:,3) = reshape(myImage(:,:,3),[],1); %blue
[array(:,4),array(:,5)] = ind2sub(size(myImage(:,:,1)),1:numel(myImage(:,:,1)));
end
カテゴリ
ヘルプ センター および File Exchange で Images についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!