필터 지우기
필터 지우기

How to fix this error: Check for incorrect argument data type or missing argument in call to function 'categories'.?

조회 수: 26 (최근 30일)
I applied the fokkowing code to read label pixel image to use it in evaluation jacard index:
dataDir = fullfile(toolboxdir('vision'),'visiondata');
imDir = fullfile(visiondatadir,'crack','7001-236.png');
Unrecognized function or variable 'visiondatadir'.
pxDir = fullfile(visiondatadir,'CrackPixelLabelData_1','Label_1.png');
imds = imageDatastore(imDir);
classNames = ["crack"];
pixelLabelID = [1];
pxds = pixelLabelDatastore(pxDir,classNames,pixelLabelID);
I = read(imds);
C = read(pxds);
categories(C)
B = labeloverlay(I,C);
figure
imshow(B)
Then, I got the following error:
Check for incorrect argument data type or missing argument in call to function 'categories'.
Error in Untitled5 (line 30)
categories(C)
How to fix it, and how to use the label image in jaccard evaluation code?

답변 (1개)

Steven Lord
Steven Lord 2023년 10월 10일
which -all categories
/MATLAB/toolbox/matlab/datatypes/categorical/@categorical/categories.m % categorical method /MATLAB/toolbox/matlab/bigdata/@tall/categories.m % tall method /MATLAB/toolbox/parallel/parallel/@codistributed/categories.m % codistributed method
This function is only defined for categorical arrays (and tall categorical and codistributed categorical arrays, I believe.) Is your variable C a categorical array? What does the command class( C) show?
  댓글 수: 7
Image Analyst
Image Analyst 2023년 10월 10일
If (the badly-named) "i" and "m" are length 0, then there is something wrong with your "Label_1.png".
yasmin ismail
yasmin ismail 2023년 10월 10일
@Image Analyst I used pixel label from image labeler App and after I finished labeling I used Export to file . Then I opened the file which created called PixelLabeData and I found the labeled image is totally black(label_1.png) which is attached and the label pixels not shown, I undertsand that I have to use the following code to let label appear:
figure;
[i, m] = imread('Label_1.png');
imshow(i,m)
but how to use [i,m] or any otherway to let the labeled pixels appear in the image (not to be black image)to be used in jaccard equation to evaluate similarity?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by