function
SLAM.LoopClosure.RGBDKeyframes.ValidFrame
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | frame | Frame | | |
| output | valid | Boolean | |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
function ValidFrame
input Frame frame;
output Boolean valid;
protected
Integer measured;
Real mass;
Real norm;
Real mean;
Real inverseCovariance[poseDimension,poseDimension];
Real scaledPivot;
Boolean covarianceValid;
algorithm
valid := frame.generation >= 1 and frame.generation <= identifierLimit
and frame.id >= 1 and frame.id < identifierLimit
and frame.epoch >= 0 and frame.epoch <= identifierLimit
and frame.imageTime >= 0 and frame.imageTime <= 1e9
and frame.count >= 0 and frame.count <= featureCapacity
and frame.vocabularyVersion >= 1 and frame.vocabularyVersion <= identifierLimit
and ValidCalibration(frame.rgbCalibration,frame.rgbSize)
and ValidCalibration(frame.depthCalibration,frame.depthSize)
and frame.disparityNoise > 0 and frame.disparityNoise <= 100
and frame.noiseReferenceFx > 0 and frame.noiseReferenceFx <= 1e6
and frame.baseline > 0 and frame.baseline <= 10
and RGBDUncertaintyProper(frame.opticalToBody)
and RGBDUncertaintyProper(frame.bodyRotation);
for axis in 1:dimension loop
valid := valid and abs(frame.bodyPosition[axis]) <= 1e6
and abs(frame.cameraOriginBody[axis]) <= 1e6;
end for;
(inverseCovariance,covarianceValid,scaledPivot) :=
RGBDUncertaintyInverse6(frame.poseCovariance,1e-10);
valid := valid and covarianceValid;
measured := 0;
for feature in 1:featureCapacity loop
if frame.enabled[feature] then
measured := measured+1;
valid := valid and feature <= frame.count
and frame.pixels[feature,1] >= 0 and frame.pixels[feature,1] < frame.rgbSize[2]
and frame.pixels[feature,2] >= 0 and frame.pixels[feature,2] < frame.rgbSize[1]
and frame.opticalPoint[feature,3] > 0;
for axis in 1:dimension loop
valid := valid and abs(frame.opticalPoint[feature,axis]) <= 1e6;
end for;
norm := 0.0;
mean := 0.0;
for sample in 1:descriptorSize loop
valid := valid and abs(frame.descriptor[feature,sample]) <= 1.000001;
norm := norm+frame.descriptor[feature,sample]^2;
mean := mean+frame.descriptor[feature,sample];
end for;
valid := valid and abs(norm-1.0) <= 1e-6 and abs(mean) <= 1e-6;
end if;
end for;
valid := valid and measured >= 8;
mass := 0.0;
for word in 1:wordCapacity loop
valid := valid and frame.histogram[word] >= 0 and frame.histogram[word] <= 1;
mass := mass+frame.histogram[word];
end for;
valid := valid and abs(mass-1.0) <= 1e-6;
end ValidFrame;