Class LucasKanade_Demo

java.lang.Object
Ch24_NonRigid_Matching.LucasKanade_Demo
All Implemented Interfaces:
PlugInFilter, JavaDocHelp

public class LucasKanade_Demo extends Object implements PlugInFilter, JavaDocHelp

This ImageJ plugin is a minimalistic example of using the Lucas-Kanade matchers. It performs a single test run on the current image, which is used as the search image I. A rectangular selection is required, which defines the initial mapping (Tinit) for the matcher, i.e., where it starts the search for the optimal match.

The ROI rectangle is also used to extract the reference image R by random perturbation of its corner coordinates. The reference image R is extracted from this warped rectangle, whose corner coordinates are not known to the matcher. Given this warped template, the task of the Lucas-Kanade matcher is to find out from where in image I is was extracted and under which transformation, using only the pixel brightness information. Since all 4 corners of the ROI are perturbed, only a projective (4-point homography) transformation can recover an accurate match!

The following steps are performed:

  • Step 0: Create the search image I.
  • Step 1: Get the rectangle of the ROI, create the (empty) reference image R of the same size.
  • Step 2: Get the corner points (Q) of the ROI.
  • Step 3: Perturb the ROI corners to form the quad QQ and use it to extract the reference image R from I.
  • Step 4: Create the Lucas-Kanade matcher (forward or inverse).
  • Step 5: Calculate the initial mapping Tinit from (centered) R → Q.
  • Step 6: Calculate the real mapping from (centered) R → QQ (for validation only).
  • Step 7: Initialize the matcher and run the matching loop.
  • Step 8: Evaluate the results.
Version:
2022/12/16
See Also: