Skip to main content
. 2020 Dec 18;20(24):7287. doi: 10.3390/s20247287
Code 7. Algorithm generating data of recognized objects.
  1. Algorithm 1: Application of object identification rules

  2. Inputs :

  3. Set D = {d: d is data record of single contour in the image} % see Figure 4

  4. Set A = {a: a is abstract object referred to in voice command}

  5. Set R = {r: r is object identification rule}

  6. Output: Set O = {o: o is data record of abstract object} % see Figure 5

  7. k ← |A|

  8. for i = 1 .. k do

  9. create new object record oi

  10. type (oi) ← type (ai)

  11. ri ← find object description for type (ai) in the library of identification rules R

  12. m ← based on description ri, determine the number of contours constituting object ai

  13. match ← true % auxiliary logical variable for verification of valid identification

  14. n ← 0 % number of instances of abstract object ai

  15. for each combination of m contour records d Є D do

  16. n ← n+1

  17. create new instance instn of object ai

  18. for j = 1..m do

  19. create new record for object contour description ocdj % see Figure 5

  20. name (ocdj) ← determine name for j-th contour according to ri

  21. pointer(ocdj) ← determine address of data record d Є D of j-th contour

  22. if contour id (pointer (ocdj)) ≠ type (name (ocdj)) then

  23. match ← false

  24. end if

  25. end for

  26. if match then

  27. v ← 0 % number of object variants for instance instn

  28. for all combinations of all variants of image contours (Figure 4) referred by instn do

  29. v ← v+1

  30. create new variant record varv for instn

  31. for j = 1..m do

  32. pointer j (varv) ← determine pointer to current variant of contour referred by

  33. pointer(ocdj)

  34. end for

  35. match ← check all conditions contained in ri in regard to instn for variant varv

  36. if not match then

  37. delete variant record varv

  38. v ← v-1

  39. end if

  40. end for

  41. if v = 0 then

  42. match ← false

  43. else

  44. match ← true

  45. end if

  46. end if

  47. if not match then

  48. delete instance instn

  49. n ← n-1

  50. end if

  51. end for

  52. for j = 1..n do

  53. for m = 12..v do

  54. set of object parameters (varm (instj(oi))) ← apply the rules for object parameter calculation

  55. end for

  56. end for

  57.   end for