function
Vision.Matching.RGBDPatchTracking.CheckReverse
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | referenceGray | Real | [:,:] | |
| input | currentGray | Real | [:,:] | |
| input | referencePixel | Real | [pixelDimension] | |
| input | trackedPixel | Real | [pixelDimension] | |
| input | forwardAccepted | Boolean | | |
| input | settings | Settings | = Settings() | |
| input | maximumCycleError | Real | = 0.25 | Pixels; independent of photometric and registration limits |
| output | accepted | Boolean | | |
| output | reason | Integer | | 0 accepted/disabled; 1 configuration; 2 current template; 3 reverse tracking; 4 cycle |
| output | returnedPixel | Real | [pixelDimension] | |
| output | cycleError | Real | | |
| output | reverseAccepted | Boolean | | |
| output | reverseReason | Integer | | |
| output | reverseIterations | Integer | | |
| output | reverseSsd | Real | | |
| output | reverseEigenvalue | Real | | |
| output | reverseDiagnostics | Diagnostics | |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
function CheckReverse
input Real referenceGray[:,:]; input Real currentGray[:,:];
input Real referencePixel[pixelDimension]; input Real trackedPixel[pixelDimension];
input Boolean forwardAccepted;
input Settings settings = Settings();
input Real maximumCycleError = 0.25 "Pixels; independent of photometric and registration limits";
output Boolean accepted;
output Integer reason "0 accepted/disabled; 1 configuration; 2 current template; 3 reverse tracking; 4 cycle";
output Real returnedPixel[pixelDimension]; output Real cycleError;
output Boolean reverseAccepted; output Integer reverseReason; output Integer reverseIterations;
output Real reverseSsd; output Real reverseEigenvalue;
output Diagnostics reverseDiagnostics;
protected
Real descriptor[patchSize]; Real jacobian[patchSize,pixelDimension]; Real energy;
Real difference[pixelDimension]; Boolean valid;
algorithm
accepted := false; reason := 0; returnedPixel := zeros(pixelDimension); cycleError := 0;
reverseAccepted := false; reverseReason := 0; reverseIterations := 0;
reverseSsd := 0; reverseEigenvalue := 0; reverseDiagnostics := Diagnostics();
// Failed/disabled forward slots are opaque, including image and setting poison.
if not forwardAccepted then return; end if;
reason := 1;
if not (size(referenceGray,1) == size(currentGray,1)
and size(referenceGray,2) == size(currentGray,2)
and maximumCycleError > 0 and maximumCycleError <= 16
and referencePixel[1] >= 0 and referencePixel[1] < size(referenceGray,2)
and referencePixel[2] >= 0 and referencePixel[2] < size(referenceGray,1)) then return; end if;
reason := 2;
(valid,descriptor,jacobian,energy) := Sample(currentGray,trackedPixel,
settings.minimumContrast,settings.interpolationMethod);
if not valid then return; end if;
reason := 3;
(reverseAccepted,returnedPixel,reverseReason,reverseIterations,reverseSsd,reverseEigenvalue,reverseDiagnostics)
:= TrackDetailed(referenceGray,descriptor,referencePixel,true,settings);
if not reverseAccepted then return; end if;
difference := returnedPixel-referencePixel; cycleError := sqrt(difference*difference);
reason := 4;
if not (cycleError <= maximumCycleError) then return; end if;
accepted := true; reason := 0;
end CheckReverse;