.mat ouput giving error

3 ビュー (過去 30 日間)
sri harsha
sri harsha 2020 年 4 月 17 日
コメント済み: Ameer Hamza 2020 年 4 月 18 日
i am trying to look at the ouput of .mat file so i loaded the ,mat in current folder
a = load('GT_IMG_1.mat');
imshow(a)
but i am getting the following error, can some one help me with this
Error using imageDisplayValidateParams
Expected input number 1, I, to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64, logical
Instead its type was struct
Error in images.internal.imageDisplayParseInputs (line 78)
common_args = images.internal.imageDisplayValidateParams(common_args);
Error in imshow (line 222)
images.internal.imageDisplayParseInputs({'Parent','Border','Reduce'},preparsed_varargin{:});

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 4 月 17 日
編集済み: Ameer Hamza 2020 年 4 月 17 日
load() function returns a struct: https://www.mathworks.com/help/matlab/ref/load.html. The struct has field names, the same as the variable names inside the .mat file. You can see the name of fields
a = load('GT_IMG_1.mat');
fieldnames(a)
and then use imshow on the field containing the image data
imshow(a.ImageVariableName) % ImageVariableName is the name of the field inside a
  13 件のコメント
sri harsha
sri harsha 2020 年 4 月 18 日
Ammer Hamza could you please tell me can i get the co-ordinates of my(mx2) pixel values
Ameer Hamza
Ameer Hamza 2020 年 4 月 18 日
You can get the location of the heads in pixel coordinates using this
a = load('GT_IMG_1.mat');
locations = a.image_info{1}.location;
You can first load the image you attached in the comment above and the use the plot the locations in mat file like this
im = imread('imge_filename'); % your image file.
imshow(im);
hold on
a = load('GT_IMG_1.mat');
locations = a.image_info{1}.location;
plot(locations(:,1), locations(:,2), '+')

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by