Package boofcv.abst.geo.bundle
Class SceneStructureMetric
java.lang.Object
boofcv.abst.geo.bundle.SceneStructureCommon
boofcv.abst.geo.bundle.SceneStructureMetric
- All Implemented Interfaces:
SceneStructure
Specifies a metric (calibrated) scene for optimizing using
BundleAdjustment
.
It specifies the relationships between cameras, views, and points. A camera projects a 3D point onto the image plane.
Examples of specific models include pinhole and fisheye. A view is a set of observed features from a specific
camera image. Views have an associated camera and specify the pose of the camera when the scene was viewed. Points
describe the scene's 3D structure.
Points belonging to the general scene and rigid objects have two different sets of ID's.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Describes the relationship between two views.static class
A set of connected points that form a rigid structure.static class
Describes a view from a camera at a particular point.Nested classes/interfaces inherited from class boofcv.abst.geo.bundle.SceneStructureCommon
SceneStructureCommon.Camera, SceneStructureCommon.Point
-
Field Summary
Modifier and TypeFieldDescriptionint[]
List of motions for the views that specifies their spatial relationshipList of rigid objects.List of views.Fields inherited from class boofcv.abst.geo.bundle.SceneStructureCommon
cameras, homogenous, points, pointSize
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Specifies a new motion.void
Assigns an ID to all rigid points.void
connectViewToCamera
(int viewIndex, int cameraIndex) Specifies that the view uses the specified cameraint
Returns the total number of parameters which will be optimisedgetParentToView
(int viewIdx) Returns SE3 relationship to the specified view from its parent.Returns SE3 relationship to the specified view from its parent.getRigid
(int rigidIdx) Returns the specifiedSceneStructureMetric.Rigid
.int
Returns total number of points associated with rigid objects.int
Returns the number of cameras with parameters that are not fixedint
Returns the number of motions with parameters that are not fixedint
Returns the number of view with parameters that are not fixedgetViewCamera
(int viewIdx) Returns the camera for this particular viewReturns the camera for this particular viewgetViewToView
(int view1, int view2) Computes and returns the transform from view1 to view2.getViewToView
(SceneStructureMetric.View view1, SceneStructureMetric.View view2) Computes and returns the transform from view1 to view2getWorldToView
(SceneStructureMetric.View view, @Nullable Se3_F64 world_to_view, @Nullable Se3_F64 tmp) Computes and returns the transform from world to view.boolean
hasRigid()
Returns true if the scene contains rigid objectsvoid
initialize
(int totalCameras, int totalViews, int totalPoints) Call this function first.void
initialize
(int totalCameras, int totalViews, int totalMotions, int totalPoints, int totalRigid) Call this function first.boolean
isIdentical
(SceneStructureMetric m, double tol) Checks to see if the passed in scene is identical to "this" scene.boolean
projectToPixel
(int pointIdx, int viewIdx, @Nullable BundleCameraState cameraState, Se3_F64 world_to_view, Se3_F64 tmpSE, Point3D_F64 tmpX, Point2D_F64 pixel) Projects the requested point onto the requested view and computes its predicted pixel coordinates.void
Declares the data structure for a rigid object.void
Specifies the spacial transform for a view and assumes the parent is the world frame.void
Specifies the spacial transform for a view and assumes the parent is the world frame.void
setView
(int viewIndex, int cameraIndex, int motionIndex, int parent) Specifies which motion is attached to a viewMethods inherited from class boofcv.abst.geo.bundle.SceneStructureCommon
connectPointToView, getCameraModel, getCameras, getObservationCount, getPoints, getUnknownCameraParameterCount, isHomogenous, removePoints, setCamera, setCamera, setCamera, setHomogenous, setPoint, setPoint
-
Field Details
-
views
List of views. A view is composed of a camera model and it's pose. -
motions
List of motions for the views that specifies their spatial relationship -
rigids
List of rigid objects. A rigid object is a group of 3D points that have a known relationship with each other. -
lookupRigid
public int[] lookupRigid
-
-
Constructor Details
-
SceneStructureMetric
public SceneStructureMetric(boolean homogenous) Configure bundle adjustment- Parameters:
homogenous
- if true then homogeneous coordinates are used
-
-
Method Details
-
initialize
public void initialize(int totalCameras, int totalViews, int totalPoints) Call this function first. Specifies number of each type of data which is available.- Parameters:
totalCameras
- Number of camerastotalViews
- Number of viewstotalPoints
- Number of points
-
initialize
public void initialize(int totalCameras, int totalViews, int totalMotions, int totalPoints, int totalRigid) Call this function first. Specifies number of each type of data which is available.- Parameters:
totalCameras
- Number of camerastotalViews
- Number of viewstotalMotions
- Number of motionstotalPoints
- Number of pointstotalRigid
- Number of rigid objects
-
assignIDsToRigidPoints
public void assignIDsToRigidPoints()Assigns an ID to all rigid points. Call this function after the structure of all the rigid objects has been specified. You must call this before you assign observations to rigid bodies, -
getParentToView
Returns SE3 relationship to the specified view from its parent.- Parameters:
view
- The target view- Returns:
- SE3 transform from parent to view.
-
getParentToView
Returns SE3 relationship to the specified view from its parent.- Parameters:
viewIdx
- Index of target view- Returns:
- SE3 transform from parent to view.
-
getWorldToView
public Se3_F64 getWorldToView(SceneStructureMetric.View view, @Nullable @Nullable Se3_F64 world_to_view, @Nullable @Nullable Se3_F64 tmp) Computes and returns the transform from world to view. If the view is relative then the chain is followed- Parameters:
view
- The target viewworld_to_view
- Storage for the found transform. Can be null.tmp
- Optional workspace to avoid creating new memory. Can be null;- Returns:
- SE3 transform from parent to view.
-
getViewToView
Computes and returns the transform from view1 to view2- Parameters:
view1
- First viewview2
- Second view- Returns:
- SE3 transform from view1 to view2.
-
getViewToView
Computes and returns the transform from view1 to view2. SeegetViewToView(View, View)
. -
hasRigid
public boolean hasRigid()Returns true if the scene contains rigid objects -
setView
Specifies the spacial transform for a view and assumes the parent is the world frame.- Parameters:
viewIndex
- Which view is being specified.cameraIndex
- Index of camera modelknown
- If these parameters are fixed or notworld_to_view
- The transform from world to view reference frames. Internal copy is saved.
-
setView
public void setView(int viewIndex, int cameraIndex, boolean known, Se3_F64 parent_to_view, int parent) Specifies the spacial transform for a view and assumes the parent is the world frame.- Parameters:
viewIndex
- Which view is being specified.cameraIndex
- Index of camera modelknown
- If the parameters are known and not optimized or unknown and optimizedparent_to_view
- The transform from parent to view reference frames. Internal copy is saved.parent
- ID / index of the parent this this view is relative to
-
setView
public void setView(int viewIndex, int cameraIndex, int motionIndex, int parent) Specifies which motion is attached to a view- Parameters:
viewIndex
- Which view is being specified.cameraIndex
- Index of camera modelmotionIndex
- The motion that describes the parent_to_view relationshipparent
- ID / index of the parent this this view is relative to
-
addMotion
Specifies a new motion.- Parameters:
known
- If the parameters are known and not optimized or unknown and optimizedparentToView
- Specifies motion from parent to view reference frames- Returns:
- Index or ID for the created motion
-
setRigid
Declares the data structure for a rigid object. Location of points are set by accessing the object directly. Rigid objects are useful in known scenes with calibration targets.- Parameters:
which
- Index of rigid objectknown
- If the parameters are known and not optimized or unknown and optimizedobjectToWorld
- Initial estimated location of rigid objecttotalPoints
- Total number of points attached to this rigid object
-
connectViewToCamera
public void connectViewToCamera(int viewIndex, int cameraIndex) Specifies that the view uses the specified camera- Parameters:
viewIndex
- index of viewcameraIndex
- index of camera
-
getUnknownCameraCount
public int getUnknownCameraCount()Returns the number of cameras with parameters that are not fixed- Returns:
- non-fixed camera count
-
getUnknownMotionCount
public int getUnknownMotionCount()Returns the number of motions with parameters that are not fixed- Returns:
- non-fixed view count
-
getUnknownRigidCount
public int getUnknownRigidCount()Returns the number of view with parameters that are not fixed- Returns:
- non-fixed view count
-
getTotalRigidPoints
public int getTotalRigidPoints()Returns total number of points associated with rigid objects. -
projectToPixel
public boolean projectToPixel(int pointIdx, int viewIdx, @Nullable @Nullable BundleCameraState cameraState, Se3_F64 world_to_view, Se3_F64 tmpSE, Point3D_F64 tmpX, Point2D_F64 pixel) Projects the requested point onto the requested view and computes its predicted pixel coordinates.- Parameters:
pointIdx
- (Input) index of pointviewIdx
- (Input) index of viewworld_to_view
- (Output) Internal work spacetmpSE
- (Output) Internal work spacetmpX
- (Output) Internal work spacepixel
- (Output) The projected pixel- Returns:
- true if it's in front of the camera or false if it's behind
-
getViewCamera
Returns the camera for this particular view -
getViewCamera
Returns the camera for this particular view -
getParameterCount
public int getParameterCount()Returns the total number of parameters which will be optimised- Returns:
- number of parameters
-
getRigid
Returns the specifiedSceneStructureMetric.Rigid
. -
isIdentical
Checks to see if the passed in scene is identical to "this" scene. Floating point values are checked to within tolerance- Returns:
- true if identical to within specified float tolerance and false if not
-