Sphere

class Sphere(*args, **kwargs)

Bases: ForwardProjection

Class that defines a 3D sphere in the object frame and allows forward projection of a 3D sphere in the camera frame and in the 2D image plane by perspective projection. All the parameters must be set in meter.

A sphere has the followings parameters:

  • in the object frame : the 3D coordinates oX, oY, oZ of the center and radius R. These parameters registered in vpForwardProjection::oP internal 4-dim vector are set using the constructors vpSphere (double oX, double oY, double oZ, double R), vpSphere(const vpColVector &oP) or the functions setWorldCoordinates(double oX, double oY, double oZ, double R) and setWorldCoordinates(const vpColVector &oP) . To get theses parameters use get_oP() .

  • in the camera frame : the coordinates cX, cY, cZ of the center and radius R. These parameters registered in vpTracker::cP internal 4-dim vector are computed using changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP) const or changeFrame(const vpHomogeneousMatrix &cMo) . These parameters could be retrieved using getX() , getY() , getZ() and getR() . To get theses parameters use get_cP() .

  • in the image plane : here we consider the parameters of the ellipse corresponding to the perspective projection of the 3D sphere. The parameters are the ellipse centroid (x, y) and n20, n11, n02 which are the second order centered moments of the ellipse normalized by its area (i.e., such that \(n_{ij} = \mu_{ij}/a\) where \(\mu_{ij}\) are the centered moments and a the area). These parameters are registered in vpTracker::p internal 5-dim vector and computed using projection() and projection(const vpColVector &cP, vpColVector &p) const . They could be retrieved using get_x() , get_y() , get_n20() , get_n11() and get_n02() . They correspond to 2D normalized sphere parameters with values expressed in meters. To get theses parameters use get_p() .

Overloaded function.

  1. __init__(self: visp._visp.core.Sphere) -> None

Default constructor.

  1. __init__(self: visp._visp.core.Sphere, oP: visp._visp.core.ColVector) -> None

Create a sphere from a 4-dim vector that contains 3D coordinates of its center and its radius. The 3D coordinates of the center are defined in the sphere frame.

  1. __init__(self: visp._visp.core.Sphere, oX: float, oY: float, oZ: float, R: float) -> None

Create a sphere from the 3D coordinates of its center and its radius. The 3D coordinates of the center are defined in the sphere frame.

Parameters:
oX

3D coordinate of the sphere center along X axis in [m].

oY

3D coordinate of the sphere center along X axis in [m].

oZ

3D coordinate of the sphere center along X axis in [m].

R

Sphere radius in [m].

Methods

__init__

Overloaded function.

changeFrame

Overloaded function.

display

Overloaded function.

getR

getX

getY

getZ

get_n02

get_n11

get_n20

get_x

get_y

projection

Overloaded function.

setWorldCoordinates

Overloaded function.

Inherited Methods

get_p

Return object parameters expressed in the 2D image plane computed by perspective projection.

user

vpDisplayForwardProjection

get_cP

Return object parameters expressed in the 3D camera frame.

getDeallocate

cP

track

Track the feature parameters in the camera frame ( vpTracker::cP ) and than compute the projection of these parameters in the image plane ( vpTracker::p ).

get_oP

Return object parameters expressed in the 3D object frame.

setDeallocate

p

project

Overloaded function.

cPAvailable

ForwardProjectionDeallocatorType

Used for memory issue especially in the vpServo class.

print

Print to stdout the feature parameters in:

oP

Operators

__doc__

__init__

Overloaded function.

__module__

Attributes

__annotations__

cP

cPAvailable

oP

p

user

vpDisplayForwardProjection

class ForwardProjectionDeallocatorType(self, value: int)

Bases: pybind11_object

Used for memory issue especially in the vpServo class.

Values:

  • user

  • vpDisplayForwardProjection

__and__(self, other: object) object
__eq__(self, other: object) bool
__ge__(self, other: object) bool
__getstate__(self) int
__gt__(self, other: object) bool
__hash__(self) int
__index__(self) int
__init__(self, value: int)
__int__(self) int
__invert__(self) object
__le__(self, other: object) bool
__lt__(self, other: object) bool
__ne__(self, other: object) bool
__or__(self, other: object) object
__rand__(self, other: object) object
__ror__(self, other: object) object
__rxor__(self, other: object) object
__setstate__(self, state: int) None
__xor__(self, other: object) object
property name : str
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: visp._visp.core.Sphere) -> None

Default constructor.

  1. __init__(self: visp._visp.core.Sphere, oP: visp._visp.core.ColVector) -> None

Create a sphere from a 4-dim vector that contains 3D coordinates of its center and its radius. The 3D coordinates of the center are defined in the sphere frame.

  1. __init__(self: visp._visp.core.Sphere, oX: float, oY: float, oZ: float, R: float) -> None

Create a sphere from the 3D coordinates of its center and its radius. The 3D coordinates of the center are defined in the sphere frame.

Parameters:
oX

3D coordinate of the sphere center along X axis in [m].

oY

3D coordinate of the sphere center along X axis in [m].

oZ

3D coordinate of the sphere center along X axis in [m].

R

Sphere radius in [m].

changeFrame(*args, **kwargs)

Overloaded function.

  1. changeFrame(self: visp._visp.core.Sphere, cMo: visp._visp.core.HomogeneousMatrix, cP: visp._visp.core.ColVector) -> None

Perspective projection of the sphere. This method doesn’t modify internal sphere parameters cP.

Parameters:
cMo

Homogeneous transformation from camera frame to sphere frame.

  1. changeFrame(self: visp._visp.core.Sphere, cMo: visp._visp.core.HomogeneousMatrix) -> None

Perspective projection of the sphere. Internal sphere parameters are modified in cP.

Parameters:
cMo

Homogeneous transformation from camera frame to object frame.

display(*args, **kwargs)

Overloaded function.

  1. display(self: visp._visp.core.Sphere, I: visp._visp.core.ImageGray, cam: visp._visp.core.CameraParameters, color: visp._visp.core.Color = vpColor::green, thickness: int = 1) -> None

Display the projection of a 3D sphere in image I .

Parameters:
I

Image used as background.

cam

Camera parameters.

color

Color used to draw the sphere.

thickness

Thickness used to draw the sphere.

  1. display(self: visp._visp.core.Sphere, I: visp._visp.core.ImageGray, cMo: visp._visp.core.HomogeneousMatrix, cam: visp._visp.core.CameraParameters, color: visp._visp.core.Color = vpColor::green, thickness: int = 1) -> None

Display the projection of a 3D sphere in image I . This method is non destructive wrt. cP and p internal sphere parameters.

Parameters:
I

Image used as background.

cMo

Homogeneous transformation from camera frame to object frame. The sphere is considered as viewed from this camera position.

cam

Camera parameters.

color

Color used to draw the sphere.

thickness

Thickness used to draw the sphere.

  1. display(self: visp._visp.core.Sphere, I: visp._visp.core.ImageRGBa, cam: visp._visp.core.CameraParameters, color: visp._visp.core.Color = vpColor::green, thickness: int = 1) -> None

Display the projection of a 3D sphere in image I .

Parameters:
I

Image used as background.

cam

Camera parameters.

color

Color used to draw the sphere.

thickness

Thickness used to draw the sphere.

  1. display(self: visp._visp.core.Sphere, I: visp._visp.core.ImageRGBa, cMo: visp._visp.core.HomogeneousMatrix, cam: visp._visp.core.CameraParameters, color: visp._visp.core.Color = vpColor::green, thickness: int = 1) -> None

Display the projection of a 3D sphere in image I . This method is non destructive wrt. cP and p internal sphere parameters.

Parameters:
I

Image used as background.

cMo

Homogeneous transformation from camera frame to object frame. The sphere is considered as viewed from this camera position.

cam

Camera parameters.

color

Color used to draw the sphere.

thickness

Thickness used to draw the sphere.

getDeallocate(self) visp._visp.core.ForwardProjection.ForwardProjectionDeallocatorType
getR(self) float
getX(self) float
getY(self) float
getZ(self) float
get_cP(self) visp._visp.core.ColVector

Return object parameters expressed in the 3D camera frame.

get_n02(self) float
get_n11(self) float
get_n20(self) float
get_oP(self) visp._visp.core.ColVector

Return object parameters expressed in the 3D object frame.

get_p(self) visp._visp.core.ColVector

Return object parameters expressed in the 2D image plane computed by perspective projection.

get_x(self) float
get_y(self) float
print(self) None

Print to stdout the feature parameters in:

  • the object frame

  • the camera frame

  • the image plane.

project(*args, **kwargs)

Overloaded function.

  1. project(self: visp._visp.core.ForwardProjection) -> None

Compute the feature parameters in the image plane ( vpTracker::p ) from the parameters in the camera frame ( vpTracker::cP ).

Warning

Be careful to update vpTracker::p and vpTracker::cP public attributes before the call of this method.

  1. project(self: visp._visp.core.ForwardProjection, cMo: visp._visp.core.HomogeneousMatrix) -> None

Compute the feature parameters in the camera frame ( vpTracker::cP ) and than compute the projection of these parameters in the image plane ( vpTracker::p ).

Warning

The feature parameters in the object frame ( vpForwardProjection :oP) need to be set prior the use of this method. To initialize these parameters see setWorldCoordinates() .

Parameters:
cMo

The homogeneous matrix corresponding to the pose between the camera frame and the object frame.

projection(*args, **kwargs)

Overloaded function.

  1. projection(self: visp._visp.core.Sphere) -> None

Perspective projection of the sphere. This method updates internal parameters (cP and p).

See vpSphere::projection(const vpColVector &, vpColVector &) const for a more detailed description of the parameters.

  1. projection(self: visp._visp.core.Sphere, cP: visp._visp.core.ColVector, p: visp._visp.core.ColVector) -> None

Perspective projection of the sphere. Internal parameters (cP and p) are not modified.

setDeallocate(self, d: visp._visp.core.ForwardProjection.ForwardProjectionDeallocatorType) None
setWorldCoordinates(*args, **kwargs)

Overloaded function.

  1. setWorldCoordinates(self: visp._visp.core.Sphere, oP: visp._visp.core.ColVector) -> None

Set sphere 3D parameters from a 4-dim vector that contains 3D coordinates of its center and its radius. The 3D coordinates of the center are defined in the sphere frame.

  1. setWorldCoordinates(self: visp._visp.core.Sphere, oX: float, oY: float, oZ: float, R: float) -> None

Set sphere 3D parameters from the 3D coordinates of its center and its radius. The 3D coordinates of the center are defined in the sphere frame.

Parameters:
oX

3D coordinate of the sphere center along X axis in [m].

oY

3D coordinate of the sphere center along X axis in [m].

oZ

3D coordinate of the sphere center along X axis in [m].

R

Sphere radius in [m].

track(self, cMo: visp._visp.core.HomogeneousMatrix) None

Track the feature parameters in the camera frame ( vpTracker::cP ) and than compute the projection of these parameters in the image plane ( vpTracker::p ).

This method is similar to project(const vpHomogeneousMatrix &) .

Warning

The feature parameters in the object frame ( vpForwardProjection :oP) need to be set prior the use of this method. To initialize these parameters see setWorldCoordinates() .

Parameters:
cMo: visp._visp.core.HomogeneousMatrix

The homogeneous matrix corresponding to the pose between the camera frame and the object frame.