|
Code 7. Algorithm generating data of recognized objects. |
| |
Algorithm 1:
Application of object identification rules
Inputs
:
Set D = {d: d is data record of single contour in the image} % see Figure 4
Set A = {a: a is abstract object referred to in voice command}
Set R = {r: r is object identification rule}
Output:
Set O = {o: o is data record of abstract object} % see Figure 5
k ← |A|
for i = 1 .. k do
create new object record oi
type (oi) ← type (ai)
ri ← find object description for type (ai) in the library of identification rules R
m ← based on description ri, determine the number of contours constituting object ai
match ← true % auxiliary logical variable for verification of valid identification
n ← 0 % number of instances of abstract object ai
for each combination of m contour records d Є D do
n ← n+1
create new instance instn of object ai
for j = 1..m do
create new record for object contour description ocdj % see Figure 5
name (ocdj) ← determine name for j-th contour according to ri
pointer(ocdj) ← determine address of data record d Є D of j-th contour
if contour id (pointer (ocdj)) ≠ type (name (ocdj)) then
match ← false
end if
end for
if match then
v ← 0 % number of object variants for instance instn
for all combinations of all variants of image contours (Figure 4) referred by instn do
v ← v+1
create new variant record varv for instn
for j = 1..m do
pointer j (varv) ← determine pointer to current variant of contour referred by
pointer(ocdj)
end for
match ← check all conditions contained in ri in regard to instn for variant varv
if not match then
delete variant record varv
v ← v-1
end if
end for
if v = 0 then
match ← false
else
match ← true
end if
end if
if not match then
delete instance instn
n ← n-1
end if
end for
for j = 1..n do
for m = 12..v do
set of object parameters (varm (instj(oi))) ← apply the rules for object parameter calculation
end for
end for
end for
|