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');
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?
0 个评论
回答(1 个)
Steven Lord
2023-10-10
which -all categories
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
2023-10-10
If (the badly-named) "i" and "m" are length 0, then there is something wrong with your "Label_1.png".
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!