PMG FILE AND INTENSITY VALUES

2 ビュー (過去 30 日間)
Aybüke Ceren Duran
Aybüke Ceren Duran 2019 年 4 月 23 日
コメント済み: Walter Roberson 2019 年 4 月 24 日
format compact
%Firstly, I converted all the images in the vector form.
whereImagesReside = 'lfwdataset';
%dir function will return the images in a structure array.
listOfImages= dir(fullfile(whereImagesReside, '*.pgm'));
%0x1 structure array is created
data = cell(size(listOfImages));
%pmg files are in 0x1 structure array.
for k=1:numel(listOfImages)
data{k}=imread(fullfile(whereImagesReside, listOfImages(k).name));
col(:,k)=data(:);
V{k}=data(:);
end
How can I get the pixel intesity of each pmg image?

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 4 月 23 日
It is not clear whether your images are RGB or not. If they are RGB then
intensity = cellfun(@rgb2gray, data, 'uniform', 0);
and then intensity would be a cell array in which each element is a pixel intensity array.
  2 件のコメント
Aybüke Ceren Duran
Aybüke Ceren Duran 2019 年 4 月 24 日
it is not RGB. So how can I get if it is not RGB?
Walter Roberson
Walter Roberson 2019 年 4 月 24 日
Ah, looking further I see that PGM is Portable Gray Map. So every value you read in is already intensity. Your col variable will have all of the intensities stored in it.

サインインしてコメントする。

カテゴリ

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