Error using vision.int​ernal.Casc​adeClassif​ier/load

I have the following error with my Matlab code I want to use vision.CascadeObjectDetector to detect object in image. I have created my labelsession successfully. But when Im running i have this error. I do not have open CV install. Do i need that to use the vision.CascadeObjectDetector?. Also how to set UseROI to true?
this is my error.
Error using vision.internal.CascadeClassifier/load Invalid OpenCV XML file. An error occurred while reading C:\Users\drake\OneDrive\Documents\MATLAB\diamonds.mat.
Error in vision.CascadeObjectDetector/loadXMLFromClassModel (line 455) obj.pCascadeClassifier.load(obj.getModelPath(obj.ClassificationModel));
Error in vision.CascadeObjectDetector/set.ClassificationModel (line 231) loadXMLFromClassModel(obj);
Error in matlab.system.SystemProp/parseInputs
Error in matlab.system.SystemProp/setProperties
Error in vision.CascadeObjectDetector (line 209) setProperties(obj,nargin,varargin{:},'ClassificationModel');
Error in Ass1 (line 121) detector = vision.CascadeObjectDetector('diamonds.mat');
and here is my code. load('diamonds.mat'); detector = vision.CascadeObjectDetector('diamonds.mat');
card1 = imread('card1.bmp');
%detect the diamonds.
bbox = step(detector,card1);
%insert bounding box rectangles and return the marked image
detectedImg = insertObjectAnnotation(card1, 'rectangle', bbox, 'diamonds');
figure;imshow(detectedImg);
Thank you for help

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Computer Vision Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by