Read .yml files in matlab

I would like to read .yml files in matlab. These files contain the x and y coordinates of the key points in the facial image. I was looking for different tools, but it seems I did not find the answers.

My .yml files look like this

YAML:1.0
Image file: "00032009.jpg"
Contours count: 8
Contours:
   -
      Name: FO
      Count: 41
      Closed: 0
      Points:
         -
            x: 682.5947265625000000
            y: 743.1998901367187500
         -
            x: 685.9638061523437500
            y: 771.3800659179687500

......

etc.

Note 00032009.jpg - the image of the face x and y - the coordinates of the point on the edge Eg: the right corner of the eye, etc.

Could you indicate a way to read the file and then display the dots on the front image?

Edit 1: Here is the error I get

Error: File: ReadYamlRaw.m Line: 14 Column: 11
Expression or statement is incorrect--possibly unbalanced (, {, or [.
Error in ==> ReadYaml at 38
    ry = ReadYamlRaw(filename, 0, nosuchfileaction);

What is strange - line 14 in ReadYamlRaw.m

[pth,~,~]= fileparts(mfilename('fullpath'));

 Parse error at ','(second one) and ']' usage appears to be invalid matlab syntax.

So what is used there ~ and why does the error occur?

Edit2 : I replaced ~ in the line above with dummy variables, then I get these errors O_O

 Error using ==> ReadYamlRaw>scan at 81
Unknown data type: logical

Error in ==> ReadYamlRaw>scan_map at 138
            result.(ich) = scan(r.get(java.lang.String(ich)));

Error in ==> ReadYamlRaw>scan at 79
        result = scan_map(r);

Error in ==> ReadYamlRaw>scan_list at 116
        result{ii} = scan(i);

Error in ==> ReadYamlRaw>scan at 77
        result = scan_list(r);

Error in ==> ReadYamlRaw>scan_map at 138
            result.(ich) = scan(r.get(java.lang.String(ich)));

Error in ==> ReadYamlRaw>scan at 79
        result = scan_map(r);

Error in ==> ReadYamlRaw>load_yaml at 48
        result = scan(yaml.load(fileread([filename, fileext])));

Error in ==> ReadYamlRaw at 19
    result = load_yaml(filename, nosuchfileaction);

Error in ==> ReadYaml at 38
    ry = ReadYamlRaw(filename, 0, nosuchfileaction);

I also tried with another yml file that looks like

%YAML:1.0
RE-C:
   x: 919
   y: 580
LE-C:
   x: 1209
   y: 597
N-C:
   x: 1063
   y: 698
FO-B:
   x: 1045
   y: 1114
REL-O:
   x: 852
   y: 597
REL-I:
   x: 986
   y: 600
REL-T:
   x: 918
   y: 564

And I get the following errors

Java exception occurred:
while scanning a directive
 in "<string>", line 1, column 1:
    %YAML:1.0
    ^
expected alphabetic or numeric character, but found :(58)
 in "<string>", line 1, column 6:
    %YAML:1.0
         ^


    at org.yaml.snakeyaml.scanner.ScannerImpl.scanDirectiveName(ScannerImpl.java:1028)

    at org.yaml.snakeyaml.scanner.ScannerImpl.scanDirective(ScannerImpl.java:990)

    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchDirective(ScannerImpl.java:534)

    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:251)

    at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:179)

    at
    org.yaml.snakeyaml.parser.ParserImpl$ParseImplicitDocumentStart.produce(ParserImpl.java:198)

    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:161)

    at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:146)

    at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105)

    at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:121)

    at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:480)

    at org.yaml.snakeyaml.Yaml.load(Yaml.java:399)


Error in ==> ReadYamlRaw>load_yaml at 48
        result = scan(yaml.load(fileread([filename, fileext])));

Error in ==> ReadYamlRaw at 19
    result = load_yaml(filename, nosuchfileaction);

Error in ==> ReadYaml at 38
    ry = ReadYamlRaw(filename, 0, nosuchfileaction);

, - - , , ? , .

+5
2

, YAML ( @DavidBrown , ). . , YAML MATLAB.

YAMLMATLAB .

YamlStruct = ReadYaml(yaml_file);

YAMLMATLAB , . , . , :

#YAML:1.0
Imagefile: 00032009.jpg
Contourscount: 8
...skipped the rest...

. , 1- x

YamlStruct.Contours{1}.Points{1}.x

ans =

  682.5947

UPDATE

, , YAMLMATLAB. . .

2

@Jirka_cigler ( YAMLMATLAB):

0.4.3 , .

!

UPDATE, .

+8

ZozaniDB Database Toolbox Matlab YAML, .yml. , :

>> yaml_parse ( str )
>> yaml_read ( filename )
0

All Articles