RelGraph

Interpretation of the structur RelGraph

The best way to get the recognition result of a line is calling the rel_textline function. It gives the most likely result respecting all options, the context, the positions and others. If you are interested in all other alternatives too, you may find all information about them in the rel_graph and rel_result fields of the RelData structure.
The reason for different recognition results lies not only in different results for single characters but also in different possibilities of segmentation of touching characters. Therefore it is not possible to report all possibilities linearly, they are arranged in a graph. You find this graph in the field rel_graph. Each knot is a RelGraph structure and denotes a possible cut. It respects up to 4 alternatives, any alternative is described by an intervall up to the next cut and the recognition result for the character over this intervall. An intervall i (i=0,1,2,3) is defined by the next cut next[i], where next[i] is the index of the corresponding knot or -1, respectively, if the intervall ends with the line. The recognition result belonging to the knot i is a RelResult structure, it is a member of the rel_result field with the index result_number[i].

The left example sideof a pair of touching characters bi will show how the informations of the graph rel_graph and the field rel_result of the RelData structure can be interpreted. The recognition should be done with the HAND.REC using the default options (different classifiers or other parameters may produce different results, and there may be different segmentations by the feedback of the recognition). It is recommmended to run the sample program RelWin under the debugger, stop it after the call of rel_do, and look at the structure rel as well as their variables.

 

There have been determined 5 cuts, the starting point included, so rel_graph_len=5. The field rel_graphcontains 5 items:

 

Node 0 (rel.rel_graph[0]), 4 Alternatives:

  1. result_number[0]=1 next[0]=1:
    rel.rel_result[1].rec_char[0]="b_"  continue at node 1.
    rel.rel_result[1].rec_value[0]=34
  2. result_number[1]=0 next[1]=-1:
    rel.rel_result[0].rec_char[0]="k_"  End of line.
    rel.rel_result[0].rec_value[0]=126
  3. result_number[2]=3 next[2]=2:
    rel.rel_result[3].rec_char[0]="b_" continue at node 2.
    rel.rel_result[3].rec_value[0]=25
  4. result_number[3]=5 next[3]=3:
    rel.rel_result[5].rec_char[0]="le" u. a.continue at node 3.
    rel.rel_result[5].rec_value[0]=44

Node 1 (rel.rel_graph[1]) 1 Alternative:

  1. result_number[0]=2 next[0]=-1:
    rel.rel_result[4].rec_char[0]="i_"
    rel.rel_result[2].rec_value[0]=62

Node 2 (rel.rel_graph[2]) 3 Alternatives:

  1. result_number[0]=4 next[0]=-1:
    rel.rel_result[4].rec_char[0]="i_" End of Line.
    rel.rel_result[4].rec_value[0]=85
  2. result_number[1]=8 next[1]=4:
    rel.rel_result[8].rec_char[0]="uv" u.a. continue at node 4.
    rel.rel_result[8].rec_value[0]=110
  3. result_number[2]=10 next[2]=1:
    result_number[2]=10 next[2]=1:
    rel.rel_result[10].rec_char[0]="._" u.a. continue at knot 1.
    rel.rel_result[10].rec_value[0]=85

Node 3 (rel.rel_graph[3]) 4 Alternatives:

  1. result_number[0]=6 next[0]=1:
    rel.rel_result[6].rec_char[0]="g9" u.a. continue at knot 1.
    rel.rel_result[6].rec_value[0]=145
  2. result_number[1]=7 next[1]=-1:
    rel.rel_result[7].rec_char[0]="n/" End of Line.
    rel.rel_result[7].rec_value[0]=122
  3. result_number[2]=11 next[2]=2:
    rel.rel_result[11].rec_char[0]="g9" u.a. continue at node 2.
    rel.rel_result[11].rec_value[0]=93
  4. result_number[3]=12 next[3]=4:
    rel.rel_result[12].rec_char[0]="g_" u.a. continue at node 4.
    rel.rel_result[12].rec_value[0]=160

Node 4 (rel.rel_graph[4]) 1 Alternative:rel.

  1. result_number[0]=9 next[0]=-1:
    rel.rel_result[9].rec_char[0]="i_" End of Line.
    rel.rel_result[9].rec_char[0]="i_"

The following alternatives were found:

1.     0->E(0)     k
2.     0 -> 1 (1) -> E ( 2)     bi
3.     0 -> 2 (3) -> E (4)     bi
4.     0 -> 2 (3) -> 4 (8) -> E (9)     bui
5.     0 -> 2 (3) -> 1 (10) -> E (2)     b.i
6.     0 -> 3 (5) -> E (7)     ln
7.     0 -> 3 (5) -> 2 (11) -> E (4)     lgi
8.     0 -> 3 (5) -> 2 (11) -> 4 (8) -> E (9)     lgui
9.     0 -> 3 (5) -> 2 (11) -> 1 (10) -> E (2)     lg.i
10.   0 -> 3 (5) -> 1 (6) -> E (2)     lgi
11.   0 -> 3 (5) -> 4 (12) -> E (9)     lgi