How to 'color in' pixels of a grayscale image sequence? Or to put it another way: how to convert my set of linear indices specifying pixels in my grayscale sequence to corresponding indices in an RGB sequence?

1 回表示 (過去 30 日間)
Nora
Nora 2013 年 11 月 28 日
回答済み: Image Analyst 2013 年 11 月 28 日
Supposing I have the linear indices of the pixels which I would like to 'color in'.
If I wanted to set all of those pixels to some specific value in my grayscale image sequence, I could do this:
gryscl_imSeq(LinearPixIndx) = 0.7;
If however, I want to introduce some color I would first need to convert my grayscale image sequence into an m x n x 3 x p matrix, which I could do like this:
RGBvideo = reshape(repmat(reshape(gryscl_imSeq,[],size(gryscl_imSeq,3)),3,1),[size(gryscl_imSeq,1) size(gryscl_imSeq,2) 3 size(gryscl_imSeq,3)]);
If somebody could tell me how to convert my grayscale linear pixels indices into corresponding indices for the RGBvideo I would really appreciate it.
Or if there is a better way to go about what I'm trying to do, I would be very grateful for any suggestions.
Thanks in Advance,
N

回答 (1 件)

Image Analyst
Image Analyst 2013 年 11 月 28 日
Try using ind2rgb().

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by