How to return array of pixel values associated with image matrix (C)?

1 回表示 (過去 30 日間)
Lexie Wilson
Lexie Wilson 2016 年 9 月 26 日
編集済み: Matthew Eicholtz 2016 年 9 月 26 日
I am using imagesc to map my array, C, to a full color image. The colors of parts of the image determine the phases of the data. I would like to determine the thresholds for ranges of pixels (ranges that correspond to phases of the data). How can I retrieve the pixel values that MATLAB automatically assigns to my data in matrix C?
clim = [0 100]; %set range for pixel color
I = imagesc(flipud(C),clim);
b = colorbar;

回答 (1 件)

Matthew Eicholtz
Matthew Eicholtz 2016 年 9 月 26 日
編集済み: Matthew Eicholtz 2016 年 9 月 26 日
Try using mat2gray.
I = mat2gray(flipud(C),clim);
EDIT: the code above will make I range from 0 to 1. If you want it in the range of clim, add this line of code:
J = I*(clim(2)-clim(1))+clim(1);

カテゴリ

Help Center および File ExchangeModify Image Colors についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by