问题
i try to apply code for face detection and tracking in matlab but unfortunately this error prompted up
i use matlab R2012a
this is the code i tried
faceDetector = vision.CascadeObjectDetector();
videoFileReader = vision.VideoFileReader('visionface.avi');
videoFrame = step(videoFileReader);
bbox = step(faceDetector, videoFrame);
videoOut = insertObjectAnnotation(videoFrame,'rectangle',bbox,'Face');
and this is the error :
Undefined function 'insertObjectAnnotation' for input
arguments of type 'single'.
please help .
回答1:
The function insertObjectAnnotation was introduced to Matlab in R2012b. it is not available for matlab R2012a
回答2:
The problem is that videoFrame
is of type single
which isn't a valid input type. Most matlab functions expect their inputs to be of type double
. Try casting videoFrame
to a double
:
ideoOut = insertObjectAnnotation( double(videoFrame), 'rectangle', bbox, 'Face');
回答3:
insertObjectAnnotation is working for windows environtment under the Computer Vision System Toolbox. It doesn't work in ubuntu.
回答4:
The function insertObjectAnnotation
did not exist in R2012a. It was added in R2012b. If you still have R2012a, you can use vision.ShapeInserter
and vision.TextInserter
system objects to annotate your image. They are not quite as convenient as insertObjectAnnotation
, but they will do the job.
来源:https://stackoverflow.com/questions/13867635/error-in-undefined-function-insertobjectannotation-in-matlab