error in Undefined function 'insertObjectAnnotation' in matlab

南楼画角 提交于 2019-12-10 17:08:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!