Line

class Line(self)

Bases: ForwardProjection

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

Note that a 3D line is defined from the intersection between two 3D planes.

A 3D line has the followings parameters:

  • in the 3D object frame : parameters are located in vpForwardProjection::oP 8-dim internal vector. They correspond to the parameters oA1, oB1, oC1, oD1 and oA2, oB2, oC2, oD2 defining the equations of the two planes. Each point \((X, Y, Z)\) which belongs to the 3D line is a solution of those two equations:

    \[oA1*X + oB1*Y + oC1*Z + oD1 = 0 \]
    \[oA2*X + oB2*Y + oC2*Z + oD2 = 0 \]

To update these line parameters you may use setWorldCoordinates() . To get theses parameters use get_oP() .

  • in the 3D camera frame : parameters are saved in vpTracker::cP 8-dim internal vector. They correspond to the parameters cA1, cB1, cC1, cD1 and cA2, cB2, cC2, cD2 defining the equations of the two planes. Each point \((X, Y, Z)\) which belongs to the 3D line is a solution of those two equations:

    \[cA1*X + cB1*Y + cC1*Z + cD1 = 0 \]
    \[cA2*X + cB2*Y + cC2*Z + cD2 = 0 \]

It is easily possible to compute these parameters thanks to the corresponding 3D parameters oP in the object frame. But you have to note that four constraints are added in the planes equations.

\[cD1 = 0 \]
\[cD2 > 0 \]
\[cA1*cA2 + cB1*cB2 + cC1*cC2 = 0 \]
\[|| cA2 || = 1 \]

To compute these parameters you may use changeFrame() . To get these parameters use get_cP() .

  • <unparsed image <doxmlparser.compound.docImageType object at 0x7ff69aad3bb0>>

The line parameters corresponding to the image frame are located in the vpTracker::p public attribute, where p is a vector defined as:

\[\begin{split}p = \left[\begin{array}{c} \rho \\\theta \end{array}\right] \end{split}\]

To compute these parameters use projection() . To get the corresponding values use get_p() .

Default constructor.

Methods

__init__

Default constructor.

changeFrame

Overloaded function.

display

Overloaded function.

getRho

Gets the \(\rho\) value corresponding to one of the two parameters used to define the line parametrization in the image plane.

getTheta

Gets the \(\theta\) angle value corresponding to one of the two parameters used to define the line parametrization in the image plane.

projection

Overloaded function.

setRho

Sets the \(\rho\) parameter used to define the line in the image plane.

setTheta

Sets the \(\theta\) angle value used to define the line in the image plane.

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__

Default constructor.

__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__(self)

Default constructor.

changeFrame(*args, **kwargs)

Overloaded function.

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

Computes the line parameters cP in the camera frame thanks to the line parameters oP given in the object frame and the homogeneous matrix relative to the pose between the camera frame and the object frame. Thus the computation gives the equations of the two planes needed to define the line in the desired frame thanks to the equations of the same two planes in the object frame.

In input of this method, the line parameters oP in the object frame are those from the vpForwardProjection::oP public attribute.

The code below shows how to use this method.

//Create the line
vpLine line;

//Set the coordinates of the line in the object frame in meter.
line.setWorldCoordinates( 1, 0, 0, -0.5, 0, 0, 1, 0.5)
//The line is define by the intersection between the plane X = 0.5m and Z = 0.5m

//Create the homogeneous matrix
vpHomogeneousMatrix cMo;
//Computes or set here the homogeneous matrix

//Creates the vector which will contain the line features
vpColVector cP(8);

//Computes the equations of the two planes in the camera frame
line.changeFrame(cMo, cP);
Parameters:
cMo

The homogeneous matrix relative to the pose between the desired frame and the object frame.

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

Computes the line parameters cP in the camera frame thanks to the line parameters oP given in the object frame and the homogeneous matrix relative to the pose cMo between the object frame and the camera frame. Thus the computation gives the equations of the two planes needed to define the line in the camera frame thanks to the equations of the same two planes in the object frame.

In input of this method, the line parameters oP in the object frame are those from the vpForwardProjection::oP public attribute.

As a result of this method, line parameters cP in the camera frame are updated in the vpTracker::cP public attribute.

The code below shows how to use this method.

//Create the line
vpLine line;

//Set the coordinates of the line in the object frame in meter.
line.setWorldCoordinates( 1, 0, 0, -0.5, 0, 0, 1, 0.5)
//The line is define by the intersection between the plane X = 0.5m and Z =
0.5m

//Create the homogeneous matrix
vpHomogeneousMatrix cMo;
//Computes or set here the homogeneous matrix

//Computes the equations of the two planes in the camera frame
line.changeFrame(cMo);
Parameters:
cMo

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

display(*args, **kwargs)

Overloaded function.

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

Displays the line in the image I thanks to the 2D parameters of the line p in the image plane ( vpTracker::p ) and the camera parameters which enable to convert the parameters from meter to pixel.

Parameters:
I

The image where the line must be displayed.

cam

The camera parameters to enable the conversion from meter to pixel.

color

The desired color to display the line in the image.

thickness

Thickness of the feature representation.

  1. display(self: visp._visp.core.Line, 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

Displays the line in the image I thanks to the parameters in the object frame ( vpForwardProjection::oP ), the homogeneous matrix relative to the pose between the camera frame and the object frame and the camera parameters which enable to convert the features from meter to pixel.

This method is non destructive wrt. cP and p internal line parameters.

Parameters:
I

The image where the line must be displayed in overlay.

cMo

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

cam

The camera parameters to enable the conversion from meter to pixel.

color

The desired color to display the line in the image.

thickness

Thickness of the feature representation.

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

Displays the line in the image I thanks to the 2D parameters of the line p in the image plane ( vpTracker::p ) and the camera parameters which enable to convert the parameters from meter to pixel.

Parameters:
I

The image where the line must be displayed.

cam

The camera parameters to enable the conversion from meter to pixel.

color

The desired color to display the line in the image.

thickness

Thickness of the feature representation.

  1. display(self: visp._visp.core.Line, 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

Displays the line in the image I thanks to the parameters in the object frame ( vpForwardProjection::oP ), the homogeneous matrix relative to the pose between the camera frame and the object frame and the camera parameters which enable to convert the features from meter to pixel.

This method is non destructive wrt. cP and p internal line parameters.

Parameters:
I

The image where the line must be displayed in overlay.

cMo

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

cam

The camera parameters to enable the conversion from meter to pixel.

color

The desired color to display the line in the image.

thickness

Thickness of the feature representation.

getDeallocate(self) visp._visp.core.ForwardProjection.ForwardProjectionDeallocatorType
getRho(self) float

Gets the \(\rho\) value corresponding to one of the two parameters used to define the line parametrization in the image plane.

Note

See getTheta()

Returns:

Returns the current value of \(\rho\) .

getTheta(self) float

Gets the \(\theta\) angle value corresponding to one of the two parameters used to define the line parametrization in the image plane.

Note

See getRho()

Returns:

Returns the current value of \(\theta\) .

get_cP(self) visp._visp.core.ColVector

Return object parameters expressed in the 3D camera frame.

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.

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.Line) -> None

Computes the 2D parameters p of the line in the image plane thanks to the 3D line parameters cP in the camera frame located in the vpTracker::cP public attribute. The parameters \(p=(\rho, \theta)\) are updated in the vpTracker::p public attribute.

Warning

To compute these parameters p , the method exploit the feature parameters cP in the camera frame. Thus, vpTracker::cP need to be updated before the call of this method. For that, a call to changeFrame(const vpHomogeneousMatrix &) is requested.

The code below shows how to use this method.

//Create the line
vpLine line;

//Set the coordinates of the line in the object frame in meter.
line.setWorldCoordinates( 1, 0, 0, -0.5, 0, 0, 1, 0.5)
//Here the line is define by the intersection between the plane X = 0.5m and
Z = 0.5m

//Create the homogeneous matrix
vpHomogeneousMatrix cMo;
//Computes or set here the homogeneous matrix

//Computes the equations of the two planes in the camera frame
line.changeFrame(cMo);

//Computes the line features in the camera frame( rho and theta)
line.projection();
  1. projection(self: visp._visp.core.Line, cP: visp._visp.core.ColVector, p: visp._visp.core.ColVector) -> None

Computes the 2D parameters p of the line in the image plane thanks to the 3D line parameters cP expressed in the camera frame. The image plane parameters \(p=(\rho , \theta)\) are updated in output.

setDeallocate(self, d: visp._visp.core.ForwardProjection.ForwardProjectionDeallocatorType) None
setRho(self, rho: float) None

Sets the \(\rho\) parameter used to define the line in the image plane.

Note

See setTheta()

Parameters:
rho: float

The desired value for \(\rho\) .

setTheta(self, theta: float) None

Sets the \(\theta\) angle value used to define the line in the image plane.

Note

See setRho()

Parameters:
theta: float

The desired value for \(\theta\) angle.

setWorldCoordinates(*args, **kwargs)

Overloaded function.

  1. setWorldCoordinates(self: visp._visp.core.Line, oA1: float, oB1: float, oC1: float, oD1: float, oA2: float, oB2: float, oC2: float, oD2: float) -> None

Sets the parameters oP which define the line in the object frame. As said in the class description, the line is defined as the intersection of two planes. The different parameters here define the equations of the two planes in the object frame. They are used to set the vpForwardProjection::oP public attribute.

\[oA1 X + oB1 Y + oC1 Z + oD1 = 0 \]
\[oA2 X + oB2 Y + oC2 Z + oD2 = 0 \]

Here \((X, Y, Z)\) are the 3D coordinates of a point in the object frame.

Parameters:
oA1

The parameters used to define the first plane in the object frame.

oB1

The parameters used to define the first plane in the object frame.

oC1

The parameters used to define the first plane in the object frame.

oD1

The parameters used to define the first plane in the object frame.

oA2

The parameters used to define the second plane in the object frame.

oB2

The parameters used to define the second plane in the object frame.

oC2

The parameters used to define the second plane in the object frame.

oD2

The parameters used to define the second plane in the object frame.

  1. setWorldCoordinates(self: visp._visp.core.Line, oP1: visp._visp.core.ColVector, oP2: visp._visp.core.ColVector) -> None

Sets the parameters oP which define the line in the object frame. As said in the class description, the line is defined as the intersection of two planes. Eight parameters are required to define the equations of the two planes in the object frame. They are used to set the vpForwardProjection::oP public attribute.

\[oA1 X + oB1 Y + oC1 Z + oD1 = 0 \]
\[oA2 X + oB2 Y + oC2 Z + oD2 = 0 \]

Here \((X, Y, Z)\) are the 3D coordinates of a point in the object frame.

Parameters:
oP1

The column vector which contains the four parameters needed to define the equations of the first plane in the object frame.

\[\begin{split}oP1 = \left[\begin{array}{c}oA1 \\oB1 \\oC1 \\oD1 \end{array}\right]\end{split}\]

oP2

The column vector which contains the four parameters needed to define the equations of the second plane in the object frame.

\[\begin{split}oP2 = \left[\begin{array}{c} oA2 \\oB2 \\oC2 \\oD2 \end{array}\right]\end{split}\]

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

Sets the parameters oP which define the line in the object frame. As said in the class description, the line is defined as the intersection of two planes. Eight parameters are required to define the equations of the two planes in the object frame. They are used to set the vpForwardProjection::oP public attribute.

\[oA1 X + oB1 Y + oC1 Z + oD1 = 0 \]
\[oA2 X + oB2 Y + oC2 Z + oD2 = 0 \]

Here \((X, Y, Z)\) are the 3D coordinates of a point in the object frame.

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.