unibas-gravis / scalismo-faces

Scalable Image Analysis and Shape Modelling: Module to work with 2d images, with a focus on face images
Apache License 2.0
118 stars 27 forks source link

GaussianRotationProposal logTransitionProbability returns -inf (see #105) #104

Open MartialBiry opened 6 years ago

MartialBiry commented 6 years ago

Bug:

The logTransitionProbability implementation in the GaussianRotationProposal class returns -inf in cases where it should be a value. For the logTransitionRatio it calls the logTransistionProbability forward (current to new proposal) and backward (new proposal to current). One of them is always -inf.

As example Data all RenderParameter can be used if the have a delta in the specific rotation angle. Initialization: GaussianRotationProposal(Vector3D.unitY, 0.01f)

If a proposal is from this ProposalGenerator then it needs a delta of yaw.

if the delta is positiv, it works as intented (the Rotation3D object has a positiv phi and the rotation axis is [0,1,0]) if the delta is negativ the Rotation3D object has an negative phi and a negative rotation axis [0,-1,0]

The last if condition checks if the Proposal is from the same axis: if (math.abs(rot.phi) > 1e-5 && rot.axis dot axis < 1.0 - 1e-4) If we have the axis [0,1,0] the dot product is 1.0, if the axis is [0,-1,0] the dot product is -1.0

Fix for this case could be if (math.abs(rot.phi) > 1e-5 && math.abs(rot.axis dot axis) < 1.0 - 1e-4)

Andreas-Forster commented 6 years ago

Associated PR #105