Input: Starting and ending pixels, and |
Output: Motion path from to |
(1) Set starting pixel as ; // Starting pixel |
(2) Set ending pixel as ; // Ending pixel |
(3) A certain proportion of accessible pixels are converted into inaccessible ones; |
(4) Add into Possible Path Location (PPL) set; |
(5) Initialize Existing Path Location (EPL) as an empty set; |
(6) ; // Current pixel |
(7) while is not equal to do |
(8) for (each adjacent pixel around , ) // Pixel traversal |
(9) if is an inaccessible pixel then |
(10) Continue; |
(11) else if belongs to EPL set then |
(12) Continue; |
(13) else if is neither in EPL set nor in PPL set then |
(14) Add into PPL set; |
(15) Set as the father pixel of ; |
(16) Calculate the Euclidean distance from to , ; |
(17) Calculate the Manhattan distance from to , ; |
(18) Set ; |
(19) else if belongs to PPL set then |
(20) Calculate the distance from to , ; |
(21) ; |
(22) If then |
(23) ; |
(24) ; |
(25) Set as the father pixel of ; |
(26) end if |
(27) end if |
(28) end for |
(29) Add into EPL set; |
(30) Remove from PPL set; |
(31) Update with the pixel with the smallest value in PPL set; |
(32) end while |
(33) ; // Initialize traversal pixel |
(34) Add into set Trace as the 1st pixel; |
(35) ; |
(36) while is not equal to |
(37) Add the father pixel of into Trace as -th pixel; |
(38) ; |
(39) ← Father pixel of ; |
(40) end while |
(41) Consecutively connect the pixels in Trace as the constructed motion path. |