issue constructing structure with valid field names for traincascadeobjectdetector
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ian
el 9 de Oct. de 2013
Respondida: Dima Lisin
el 24 de Dic. de 2013
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 comentarios
Respuesta aceptada
Sean de Wolski
el 9 de Oct. de 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')
Más respuestas (1)
Dima Lisin
el 24 de Dic. de 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 comentarios
Ver también
Categorías
Más información sobre Structures en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!