Package com.irurueta.ar.sfm
Class BaseSlamSparseReconstructor<D extends BaseCalibrationData,C extends BaseSlamSparseReconstructorConfiguration<D,C>,R extends BaseSlamSparseReconstructor<D,C,R,L,S>,L extends BaseSlamSparseReconstructorListener<R>,S extends BaseSlamEstimator<D>>
java.lang.Object
com.irurueta.ar.sfm.BaseSparseReconstructor<C,R,L>
com.irurueta.ar.sfm.BaseSlamSparseReconstructor<D,C,R,L,S>
- Type Parameters:
D
- type defining calibration data.C
- type of configuration.R
- type of re-constructor.L
- type of listener.S
- type of SLAM estimator.
- Direct Known Subclasses:
BaseAbsoluteOrientationSlamSparseReconstructor
,ConstantVelocityModelSlamSparseReconstructor
,SlamSparseReconstructor
public abstract class BaseSlamSparseReconstructor<D extends BaseCalibrationData,C extends BaseSlamSparseReconstructorConfiguration<D,C>,R extends BaseSlamSparseReconstructor<D,C,R,L,S>,L extends BaseSlamSparseReconstructorListener<R>,S extends BaseSlamEstimator<D>>
extends BaseSparseReconstructor<C,R,L>
Base class in charge of estimating cameras and 3D reconstructed points from sparse
image point correspondences in multiple views and also in charge of estimating overall
scene scale by means of SLAM (Simultaneous Location And Mapping) using data obtained
from sensors like accelerometers or gyroscopes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate 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.protected 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.BaseSparseReconstructor
activeEuclideanReconstructedPoints, activeMetricReconstructedPoints, configuration, currentEuclideanEstimatedCamera, currentMetricEstimatedCamera, currentScale, DEFAULT_SCALE, failed, listener, MIN_NUMBER_OF_VIEWS, previousEuclideanEstimatedCamera, previousMetricEstimatedCamera, running
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BaseSlamSparseReconstructor
(C configuration, L listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate 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.protected void
Configures calibration data on SLAM estimator if available.protected void
Configures listener of SLAM estimatorvoid
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.protected boolean
updateScale
(boolean isInitialPairOfViews) Update scene scale using SLAM data.Methods inherited from class com.irurueta.ar.sfm.BaseSparseReconstructor
cancel, getActiveEuclideanReconstructedPoints, getActiveMetricReconstructedPoints, getConfiguration, getCurrentEstimatedFundamentalMatrix, getCurrentEuclideanEstimatedCamera, getCurrentMetricEstimatedCamera, getCurrentScale, getCurrentViewNewlySpawnedSamples, getCurrentViewTrackedSamples, getListener, getPreviousEuclideanEstimatedCamera, getPreviousMetricEstimatedCamera, getPreviousViewTrackedSamples, getViewCount, hasFailed, isAdditionalView, isCancelled, isFinished, isFirstView, isRunning, isSecondView, postProcessOne, processOneView, reset, start
-
Field Details
-
slamEstimator
Slam estimator to estimate position, speed, orientation using accelerometer and gyroscope data. -
slamPosition
protected final com.irurueta.geometry.InhomogeneousPoint3D slamPositionPosition estimated by means of SLAM. It is reused each time it is notified. -
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.
-
-
Constructor Details
-
BaseSlamSparseReconstructor
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.
-
setUpCalibrationData
protected void setUpCalibrationData()Configures calibration data on SLAM estimator if available. -
setUpSlamEstimatorListener
protected void setUpSlamEstimatorListener()Configures listener of SLAM estimator -
updateScale
protected boolean updateScale(boolean isInitialPairOfViews) Update scene scale using SLAM data.- Parameters:
isInitialPairOfViews
- true if initial pair of views is being processed, false otherwise.- Returns:
- true if scale was successfully updated, false otherwise.
-
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.
-