issue constructing structure with valid field names for traincascadeobjectdetector
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Sean de Wolski
il 9 Ott 2013
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')
Più risposte (1)
Dima Lisin
il 24 Dic 2013
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 Commenti
Vedere anche
Categorie
Scopri di più su Structures in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!