.mat ouput giving error
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
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
2020년 4월 17일
편집: Ameer Hamza
2020년 4월 17일
1 개 추천
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
2020년 4월 17일
편집: sri harsha
2020년 4월 17일
i got the variable is having an cell , so could you tell me how to access it
and i got the following error
a = load('GT_IMG_1.mat');
fieldnames(a)
ans =
'image-info'
>> imshow(a.image_info);
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 cell.
Error in images.internal.imageDisplayValidateParams (line 11)
validateattributes(common_args.CData, {'numeric','logical'},...
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
2020년 4월 17일
Can you attach the .mat file "GT_IMG_1.mat"?
sri harsha
2020년 4월 17일
this is my GT_IMG_1.mat file representing ground truth of an image
sri harsha
2020년 4월 17일
could you plese look and tell
sri harsha
2020년 4월 17일
Ameer Hamza bro please look into it
Ameer Hamza
2020년 4월 17일
sri harsha, Your .mat file does not contain any image. It just contain a cell array which also does not contain any image.
sri harsha
2020년 4월 18일
could you please just tell me how to do you come to know ,you plottted the .mat to image?
or by what other method you verified that it doesnt contain image
please tell me;
thank you
Ameer Hamza
2020년 4월 18일
An image file is a matrix of size m*n, where m and n are the height and width of the image in pixels. Even a typical low-resolution image usually has m>200, and n>200. The cell array in your .mat file has a matrix of size mx2. If you make it as an image, it will just be two pixels wide. It will not be observable.
sri harsha
2020년 4월 18일
편집: sri harsha
2020년 4월 18일
ya i waht you said is true,imagine if those pixels value(represent) the heads of people,, all in the image ,can i consider (mx2) it to be the pixel values of head,beacuse i am working on crowd counting based on head detection ad it is its dataset

Ameer Hamza
2020년 4월 18일
Yes, that is also possible, but you still cannot call imshow() function on that information. imshow() need information about all the pixels in the image.
sri harsha
2020년 4월 18일
ok tq,but can i know the distance in a image , i mean which pixel it is representing by (mx2) pixel coardinates, imean is there a way to verify the pixel values in (mx2) isrepresenting which area in an image
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
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개)
카테고리
도움말 센터 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
