issue constructing structure with valid field names for traincascadeobjectdetector
7 次查看(过去 30 天)
显示 更早的评论
Hello All,
I am attempting to train my own cascade object detector via the computer vision toolboxes' trainCascadeObjectDetector function and following the extensive help files and examples. This is proving to be rather difficult however (impossible even). trainCascadeObjectDetector takes an array of structs called positiveInstances in the help file. It describes the structure as having a field of the image file name as a string, and the values as a bounding box around the ROI. After much head scratching, I have found the root of my problem on the help file for struct:
Valid field names begin with a letter, and can contain letters, digits, and underscores.
No punctuation! How can I specify a string of a file name without punctuation for the extension? i.e. "image0001.jpg"
I feel like I am missing something important...
I am running 2012a on a linux machine.
Any help is much appreciated,
Ian
0 个评论
采纳的回答
Sean de Wolski
2013-10-9
No. Fieldnames have to be valid MATLAB variable names. If you need to create them on the fly, you can use genvarname:
genvarname('image0001.jpg')
And isvarname to check beforehand:
isvarname('image0001.jpg')
更多回答(1 个)
Dima Lisin
2013-12-24
There seems to be some confusion here. There are two fields in the struct. The name of the first field is 'imageFilename', and its value is the file name, such as 'image0001.jpg'. The name of the second field is 'objectBoundingBoxes', and its value is the M-by-4 matrix of the form [x, y, w, h].
So, you do not need to turn the file names into field names. Does this make sense?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!