Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm having trouble reading YAML

I have this YAML file that I've built

items.yml:

%YAML:1.0
#items:
-
  item   : 1
  round  : true
  hc     : [50,110,40,270,330]
  detect : 
  area   : 0
-
  item   : 2
  round  : true
  hc     : [50,110,40,270,330]
  detect : SURF
  area   : 0
-
  item   : 3
  round  : false
  hc     : null
  detect : SURF
  area   : 2
...

I also have Item struct that fits to the items YAML I want to add them to vector<item> in a loop. I have read the yaml spec, and opencv docs and examples I've tried a lot to read the YAML file but every time a came across with annoying exceptions.

1. The struct it self is very sensitive more than some online YAML editors that I tried them on (tabs and whitespace), so this is how I got to this, a working non errors FileStorage, construction of the YAML file. If I need to change it please fix me.

2. The reading is somehow more complex. I've read before only yaml object:value with no loop needed But here I'm not sure how to loop this. I've saw YAML libraries solutions that get size and the main object but I failed doing it myself.

Any help would be appreciated. thanks!

I'm having trouble reading YAML

I have this YAML file that I've built

items.yml:

%YAML:1.0
#items:
-
  item   : 1
  round  : true
  hc     : [50,110,40,270,330]
  detect : 
  area   : 0
-
  item   : 2
  round  : true
  hc     : [50,110,40,270,330]
  detect : SURF
  area   : 0
-
  item   : 3
  round  : false
  hc     : null
  detect : SURF
  area   : 2
...

I also have Item struct that fits to the items YAML I want to add them to vector<item> in a loop. I have read the yaml spec, and opencv docs and examples I've tried a lot to read the YAML file but every time a came across with annoying exceptions.

1. The struct it self is very sensitive more than some online YAML editors that I tried them on (tabs and whitespace), so this is how I got to this, a working non errors FileStorage, construction of the YAML file. If I need to change it please fix me.

2. The reading is somehow more complex. I've read before only yaml object:value with no loop needed But here I'm not sure how to loop this. I've saw YAML libraries solutions that get size and the main object but I failed doing it myself.

Any help would be appreciated. thanks!

I'm having trouble reading YAML

I have this YAML file that I've built

items.yml:

%YAML:1.0
#items:
-
  item   : 1
  round  : true
  hc     : [50,110,40,270,330]
  detect : 
  area   : 0
-
  item   : 2
  round  : true
  hc     : [50,110,40,270,330]
  detect : SURF
  area   : 0
-
  item   : 3
  round  : false
  hc     : null
  detect : SURF
  area   : 2
...

I also have Item struct that fits to the items YAML I want to add them to vector<item> in a loop. I have read the yaml spec, and opencv docs and examples I've tried a lot to read the YAML file but every time a came across with annoying exceptions.

1. The struct it self is very sensitive more than some online YAML editors that I tried them on (tabs and whitespace), so this is how I got to this, a working non errors FileStorage, construction of the YAML file. If I need to change it please fix me.

2. The reading is somehow more complex. I've read before only yaml object:value with no loop needed But here I'm not sure how to loop this. I've saw YAML libraries solutions that get size and the main object but I failed doing it myself.

Any help would be appreciated. thanks!