Package com.irurueta.ar.sfm
Class BaseSlamPairedViewsSparseReconstructor<D extends BaseCalibrationData,C extends BaseSlamPairedViewsSparseReconstructorConfiguration<D,C>,R extends BaseSlamPairedViewsSparseReconstructor<D,C,R,L,S>,L extends BaseSlamPairedViewsSparseReconstructorListener<R>,S extends BaseSlamEstimator<D>>
java.lang.Object
com.irurueta.ar.sfm.BasePairedViewsSparseReconstructor<C,R,L>
com.irurueta.ar.sfm.BaseSlamPairedViewsSparseReconstructor<D,C,R,L,S>
- Direct Known Subclasses:
BaseAbsoluteOrientationSlamPairedViewsSparseReconstructor
,ConstantVelocityModelSlamPairedViewsSparseReconstructor
,SlamPairedViewsSparseReconstructor
public abstract class BaseSlamPairedViewsSparseReconstructor<D extends BaseCalibrationData,C extends BaseSlamPairedViewsSparseReconstructorConfiguration<D,C>,R extends BaseSlamPairedViewsSparseReconstructor<D,C,R,L,S>,L extends BaseSlamPairedViewsSparseReconstructorListener<R>,S extends BaseSlamEstimator<D>>
extends BasePairedViewsSparseReconstructor<C,R,L>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate com.irurueta.geometry.Rotation3D
Inverse Euclidean camera rotation.private long
Last SLAM timestamp.private long
Last view pair SLAM timestamp.private final com.irurueta.geometry.PinholeCamera
Camera estimated by means of SLAM.protected S
Slam estimator to estimate position, speed, orientation using accelerometer and gyroscope data.private final com.irurueta.geometry.InhomogeneousPoint3D
Position estimated by means of SLAM.private final com.irurueta.geometry.Quaternion
Camera rotation estimated by means of SLAM.Fields inherited from class com.irurueta.ar.sfm.BasePairedViewsSparseReconstructor
configuration, currentEuclideanEstimatedCamera, currentMetricEstimatedCamera, currentScale, currentViewId, DEFAULT_SCALE, euclideanReconstructedPoints, failed, lastEuclideanCameraCenter, lastEuclideanCameraRotation, listener, metricReconstructedPoints, MIN_NUMBER_OF_VIEWS, previousEuclideanEstimatedCamera, previousMetricEstimatedCamera, previousViewId, referenceEuclideanTransformation, running
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BaseSlamPairedViewsSparseReconstructor
(C configuration, L listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate double
Estimates current scale using SLAM data.protected boolean
Indicates whether implementations of a re-constructor uses absolute orientation or not.private void
Notifies estimated camera by means of SLAM if notification is enabled at configuration time and intrinsics are already available.private void
Notifies SLAM state if notification is enabled at configuration time.void
reset()
Resets this instance so that a reconstruction can be started from the beginning without cancelling current one.protected void
Configures calibration data on SLAM estimator if available.protected void
Configures listener of SLAM estimatorprotected boolean
transformPairOfCamerasAndPoints
(boolean isInitialPairOfViews, boolean hasAbsoluteOrientation) Transforms metric cameras on current pair of views so that they are referred to last kept location and rotation and upgrades cameras from metric stratum to Euclidean stratum.void
updateAccelerometerSample
(long timestamp, float[] data) Provides a new accelerometer sample to update SLAM estimation.void
updateAccelerometerSample
(long timestamp, float accelerationX, float accelerationY, float accelerationZ) Provides a new accelerometer sample to update SLAM estimation.void
updateGyroscopeSample
(long timestamp, float[] data) Provides a new gyroscope sample to update SLAM estimation.void
updateGyroscopeSample
(long timestamp, float angularSpeedX, float angularSpeedY, float angularSpeedZ) Provides a new gyroscope sample to update SLAM estimation.Methods inherited from class com.irurueta.ar.sfm.BasePairedViewsSparseReconstructor
cancel, getConfiguration, getCurrentEstimatedFundamentalMatrix, getCurrentEuclideanEstimatedCamera, getCurrentMetricEstimatedCamera, getCurrentScale, getCurrentViewSamples, getEuclideanReconstructedPoints, getListener, getMetricReconstructedPoints, getPreviousEuclideanEstimatedCamera, getPreviousMetricEstimatedCamera, getPreviousViewSamples, getViewCount, hasFailed, isAdditionalViewPair, isCancelled, isFinished, isFirstViewPair, isRunning, processOneViewPair, start
-
Field Details
-
slamEstimator
Slam estimator to estimate position, speed, orientation using accelerometer and gyroscope data. -
slamPosition
private final com.irurueta.geometry.InhomogeneousPoint3D slamPositionPosition estimated by means of SLAM. It is reused each time it is notified. -
invEuclideanCameraRotation
private com.irurueta.geometry.Rotation3D invEuclideanCameraRotationInverse Euclidean camera rotation. This is reused for memory efficiency. -
slamCamera
private final com.irurueta.geometry.PinholeCamera slamCameraCamera estimated by means of SLAM. It is reused each time it is notified. -
slamRotation
private final com.irurueta.geometry.Quaternion slamRotationCamera rotation estimated by means of SLAM. It is reused each time it is notified. -
lastTimestamp
private long lastTimestampLast SLAM timestamp. -
lastViewPairTimestamp
private long lastViewPairTimestampLast view pair SLAM timestamp.
-
-
Constructor Details
-
BaseSlamPairedViewsSparseReconstructor
Constructor.- Parameters:
configuration
- configuration for this re-constructor.listener
- listener in charge of handling events.- Throws:
NullPointerException
- if listener or configuration is not provided.
-
-
Method Details
-
updateAccelerometerSample
public void updateAccelerometerSample(long timestamp, float accelerationX, float accelerationY, float accelerationZ) Provides a new accelerometer sample to update SLAM estimation. This method must be called whenever the accelerometer sensor receives new data. If re-constructor is not running, calling this method has no effect.- Parameters:
timestamp
- timestamp of accelerometer sample since epoch time and expressed in nanoseconds.accelerationX
- linear acceleration along x-axis expressed in meters per squared second (m/s^2).accelerationY
- linear acceleration along y-axis expressed in meters per squared second (m/s^2).accelerationZ
- linear acceleration along z-axis expressed in meters per squared second (m/s^2).
-
updateAccelerometerSample
public void updateAccelerometerSample(long timestamp, float[] data) Provides a new accelerometer sample to update SLAM estimation. This method must be called whenever the accelerometer sensor receives new data. If re-constructor is not running, calling this method has no effect.- Parameters:
timestamp
- timestamp of accelerometer sample since epoch time and expressed in nanoseconds.data
- array containing x,y,z components of linear acceleration expressed in meters per squared second (m/s^2).- Throws:
IllegalArgumentException
- if provided array does not have length 3.
-
updateGyroscopeSample
public void updateGyroscopeSample(long timestamp, float angularSpeedX, float angularSpeedY, float angularSpeedZ) Provides a new gyroscope sample to update SLAM estimation. If re-constructor is not running, calling this method has no effect.- Parameters:
timestamp
- timestamp of gyroscope sample since epoch time and expressed in nanoseconds.angularSpeedX
- angular speed of rotation along x-axis expressed in radians per second (rad/s).angularSpeedY
- angular speed of rotation along y-axis expressed in radians per second (rad/s).angularSpeedZ
- angular speed of rotation along z-axis expressed in radians per second (rad/s).
-
updateGyroscopeSample
public void updateGyroscopeSample(long timestamp, float[] data) Provides a new gyroscope sample to update SLAM estimation. If re-constructor is not running, calling this method has no effect.- Parameters:
timestamp
- timestamp of gyroscope sample since epoch time and expressed in nanoseconds.data
- angular speed of rotation along x,y,z axes expressed in radians per second (rad/s).- Throws:
IllegalArgumentException
- if provided array does not have length 3.
-
reset
public void reset()Resets this instance so that a reconstruction can be started from the beginning without cancelling current one.- Overrides:
reset
in classBasePairedViewsSparseReconstructor<C extends BaseSlamPairedViewsSparseReconstructorConfiguration<D,
C>, R extends BaseSlamPairedViewsSparseReconstructor<D, C, R, L, S>, L extends BaseSlamPairedViewsSparseReconstructorListener<R>>
-
hasAbsoluteOrientation
protected boolean hasAbsoluteOrientation()Indicates whether implementations of a re-constructor uses absolute orientation or not.- Specified by:
hasAbsoluteOrientation
in classBasePairedViewsSparseReconstructor<C extends BaseSlamPairedViewsSparseReconstructorConfiguration<D,
C>, R extends BaseSlamPairedViewsSparseReconstructor<D, C, R, L, S>, L extends BaseSlamPairedViewsSparseReconstructorListener<R>> - Returns:
- true if absolute orientation is used, false, otherwise.
-
setUpCalibrationData
protected void setUpCalibrationData()Configures calibration data on SLAM estimator if available. -
setUpSlamEstimatorListener
protected void setUpSlamEstimatorListener()Configures listener of SLAM estimator -
transformPairOfCamerasAndPoints
protected boolean transformPairOfCamerasAndPoints(boolean isInitialPairOfViews, boolean hasAbsoluteOrientation) Transforms metric cameras on current pair of views so that they are referred to last kept location and rotation and upgrades cameras from metric stratum to Euclidean stratum.- Overrides:
transformPairOfCamerasAndPoints
in classBasePairedViewsSparseReconstructor<C extends BaseSlamPairedViewsSparseReconstructorConfiguration<D,
C>, R extends BaseSlamPairedViewsSparseReconstructor<D, C, R, L, S>, L extends BaseSlamPairedViewsSparseReconstructorListener<R>> - Parameters:
isInitialPairOfViews
- true if initial pair of views is being processed, false otherwise.hasAbsoluteOrientation
- true if absolute orientation is required, false otherwise.- Returns:
- true if cameras were successfully transformed.
-
estimateCurrentScale
private double estimateCurrentScale()Estimates current scale using SLAM data.- Returns:
- estimated scale.
-
notifySlamStateIfNeeded
private void notifySlamStateIfNeeded()Notifies SLAM state if notification is enabled at configuration time. -
notifySlamCameraIfNeeded
private void notifySlamCameraIfNeeded()Notifies estimated camera by means of SLAM if notification is enabled at configuration time and intrinsics are already available.
-