Package com.irurueta.ar.sfm
Class BaseSlamTwoViewsSparseReconstructor<D extends BaseCalibrationData,C extends BaseSlamTwoViewsSparseReconstructorConfiguration<D,C>,R extends BaseSlamTwoViewsSparseReconstructor<D,C,R,L,S>,L extends BaseSlamTwoViewsSparseReconstructorListener<R>,S extends BaseSlamEstimator<D>>
java.lang.Object
com.irurueta.ar.sfm.BaseTwoViewsSparseReconstructor<C,R,L>
com.irurueta.ar.sfm.BaseSlamTwoViewsSparseReconstructor<D,C,R,L,S>
- Type Parameters:
D
- type of calibration data.C
- type of configuration.R
- type of re-constructor.L
- type of listener.S
- type of SLAM estimator.
- Direct Known Subclasses:
BaseAbsoluteOrientationSlamTwoViewsSparseReconstructor
,ConstantVelocityModelSlamTwoViewsSparseReconstructor
,SlamTwoViewsSparseReconstructor
public abstract class BaseSlamTwoViewsSparseReconstructor<D extends BaseCalibrationData,C extends BaseSlamTwoViewsSparseReconstructorConfiguration<D,C>,R extends BaseSlamTwoViewsSparseReconstructor<D,C,R,L,S>,L extends BaseSlamTwoViewsSparseReconstructorListener<R>,S extends BaseSlamEstimator<D>>
extends BaseTwoViewsSparseReconstructor<C,R,L>
Base class in charge of estimating cameras and 3D reconstructed points from
sparse image point correspondences in two 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.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.BaseTwoViewsSparseReconstructor
configuration, estimatedCamera1, estimatedCamera2, estimatedFundamentalMatrix, failed, listener, NUMBER_OF_VIEWS, reconstructedPoints, running
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BaseSlamTwoViewsSparseReconstructor
(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
Set ups 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
Update scene scale using SLAM data.Methods inherited from class com.irurueta.ar.sfm.BaseTwoViewsSparseReconstructor
cancel, getConfiguration, getEstimatedCamera1, getEstimatedCamera2, getEstimatedFundamentalMatrix, getListener, getReconstructedPoints, getViewCount, hasFailed, isCancelled, isFinished, isRunning, postProcessOne, processOneView, reset, 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. -
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
-
BaseSlamTwoViewsSparseReconstructor
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()Set ups calibration data on SLAM estimator if available. -
setUpSlamEstimatorListener
protected void setUpSlamEstimatorListener()Configures listener of SLAM estimator -
updateScale
protected boolean updateScale()Update scene scale using SLAM data.- 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.
-