Polygon3D

class Polygon3D(*args, **kwargs)

Bases: pybind11_object

Implements a 3D polygon with render functionalities like clipping.

Overloaded function.

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

Basic constructor.

  1. __init__(self: visp._visp.core.Polygon3D, mbtp: visp._visp.core.Polygon3D) -> None

Methods

__init__

Overloaded function.

addPoint

Add a corner point to the list of polygon's corners.

changeFrame

Project the 3D corner points into the image thanks to the pose of the camera.

computePolygonClipped

Compute the region of interest in the image according to the used clipping.

getClippedPolygon

Static method to compute the clipped points from a set of initial points.

getClipping

Get the clipping used.

getFarClippingDistance

Get the far distance for clipping.

getMinMaxRoi

return:

A tuple containing:

getNbCornerInsideImage

Static method to check the number of points of a region defined by the vector of image point that are inside the image.

getNbCornerInsidePrevImage

Return the number of corners at the previous computation.

getNbPoint

Return the number of corners.

getNearClippingDistance

Get the near distance for clipping.

getPoint

Get a reference to a corner.

getPolygonClipped

Get the 3D clipped points.

getPolygonClippedWithInfo

Get the 3D clipped points and their clipping information.

getRoi

Overloaded function.

getRoiClipped

Overloaded function.

roiInsideImage

Static method to check whether the region defined by the vector of image point is contained entirely in the image.

setClipping

Specify which clipping to use.

setFarClippingDistance

Set the far distance for clipping.

setNbPoint

Set the number of points which are the corners of the polygon.

setNearClippingDistance

Set the near distance for clipping.

Inherited Methods

Operators

__doc__

__init__

Overloaded function.

__module__

Attributes

ALL_CLIPPING

DOWN_CLIPPING

FAR_CLIPPING

FOV_CLIPPING

LEFT_CLIPPING

NEAR_CLIPPING

NO_CLIPPING

RIGHT_CLIPPING

UP_CLIPPING

__annotations__

clippingFlag

distFarClip

distNearClip

nbCornersInsidePrev

nbpt

polyClipped

class Polygon3DClippingType(self, value: int)

Bases: pybind11_object

Values:

  • NO_CLIPPING

  • NEAR_CLIPPING

  • FAR_CLIPPING

  • LEFT_CLIPPING

  • RIGHT_CLIPPING

  • UP_CLIPPING

  • DOWN_CLIPPING

  • FOV_CLIPPING

  • ALL_CLIPPING

__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.Polygon3D) -> None

Basic constructor.

  1. __init__(self: visp._visp.core.Polygon3D, mbtp: visp._visp.core.Polygon3D) -> None

addPoint(self, n: int, P: visp._visp.core.Point) None

Add a corner point to the list of polygon’s corners.

Parameters:
n: int

The index of the corner.

P: visp._visp.core.Point

The point to add.

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

Project the 3D corner points into the image thanks to the pose of the camera.

Parameters:
cMo: visp._visp.core.HomogeneousMatrix

The pose of the camera.

computePolygonClipped(self, cam: visp._visp.core.CameraParameters = vpCameraParameters()) None

Compute the region of interest in the image according to the used clipping.

Warning

If the FOV clipping is used, camera normals have to be precomputed.

Parameters:
cam: visp._visp.core.CameraParameters = vpCameraParameters()

camera parameters used to compute the field of view.

static getClippedPolygon(ptIn: list[visp._visp.core.Point], cMo: visp._visp.core.HomogeneousMatrix, clippingFlags: int, cam: visp._visp.core.CameraParameters = vpCameraParameters(), znear: float = 0.001, zfar: float = 100) list[visp._visp.core.Point]

Static method to compute the clipped points from a set of initial points.

Warning

When using FOV clipping and personnal camera parameters, camera normals have to be computed before (see vpCameraParameters::computeFov() )

Parameters:
ptIn: list[visp._visp.core.Point]

Input points

cMo: visp._visp.core.HomogeneousMatrix

Pose considered for the clipping.

clippingFlags: int

Clipping flag (see vpPolygon3D::vpPolygon3DClippingType ).

cam: visp._visp.core.CameraParameters = vpCameraParameters()

Camera parameters (Only used if clipping flags contain FOV clipping).

znear: float = 0.001

Near clipping distance value (Only used if clipping flags contain Near clipping).

zfar: float = 100

Far clipping distance value (Only used if clipping flags contain Far clipping).

Returns:

A tuple containing:

  • ptOut: Output points (result of the clipping).

getClipping(self) int

Get the clipping used.

Returns:

Clipping flags.

getFarClippingDistance(self) float

Get the far distance for clipping.

Returns:

Far clipping value.

static getMinMaxRoi(roi: list[visp._visp.core.ImagePoint]) tuple[int, int, int, int]
Returns:

A tuple containing:

  • i_min

  • i_max

  • j_min

  • j_max

getNbCornerInsideImage(self, I: visp._visp.core.ImageGray, cam: visp._visp.core.CameraParameters) int

Static method to check the number of points of a region defined by the vector of image point that are inside the image.

Parameters:
I: visp._visp.core.ImageGray

The image used for its size.

cam: visp._visp.core.CameraParameters

The camera parameters.

getNbCornerInsidePrevImage(self) int

Return the number of corners at the previous computation.

Returns:

number of corner of the face at the previous computation

getNbPoint(self) int

Return the number of corners.

Returns:

number of corner of the face

getNearClippingDistance(self) float

Get the near distance for clipping.

Returns:

Near clipping value.

getPoint(self, _index: int) visp._visp.core.Point

Get a reference to a corner.

Parameters:
_index: int

the index of the corner

getPolygonClipped(self) list[visp._visp.core.Point]

Get the 3D clipped points.

Warning

Suppose that changeFrame() and computePolygonClipped() have already been called.

Returns:

A tuple containing:

  • poly: resulting points.

getPolygonClippedWithInfo(self) list[tuple[visp._visp.core.Point, int]]

Get the 3D clipped points and their clipping information.

Warning

Suppose that changeFrame() and computePolygonClipped() have already been called.

Returns:

A tuple containing:

  • poly: resulting points plus clipping information.

getRoi(*args, **kwargs)

Overloaded function.

  1. getRoi(self: visp._visp.core.Polygon3D, cam: visp._visp.core.CameraParameters) -> list[visp._visp.core.ImagePoint]

Get the region of interest in the image.

Parameters:
cam

camera parameters.

Returns:

Image point corresponding to the region of interest.

  1. getRoi(self: visp._visp.core.Polygon3D, cam: visp._visp.core.CameraParameters, cMo: visp._visp.core.HomogeneousMatrix) -> list[visp._visp.core.ImagePoint]

Get the region of interest in the image.

Parameters:
cam

camera parameters.

cMo

pose.

Returns:

Image point corresponding to the region of interest.

getRoiClipped(*args, **kwargs)

Overloaded function.

  1. getRoiClipped(self: visp._visp.core.Polygon3D, cam: visp._visp.core.CameraParameters) -> list[visp._visp.core.ImagePoint]

Get the region of interest clipped in the image.

Warning

Suppose that changeFrame() and computePolygonClipped() have already been called.

Parameters:
cam

camera parameters.

Returns:

A tuple containing:

  • roi: image point corresponding to the region of interest.

  1. getRoiClipped(self: visp._visp.core.Polygon3D, cam: visp._visp.core.CameraParameters, cMo: visp._visp.core.HomogeneousMatrix) -> list[visp._visp.core.ImagePoint]

Get the region of interest clipped in the image.

Parameters:
cam

camera parameters.

cMo

pose.

Returns:

A tuple containing:

  • roi: image point corresponding to the region of interest.

  1. getRoiClipped(self: visp._visp.core.Polygon3D, cam: visp._visp.core.CameraParameters) -> list[tuple[visp._visp.core.ImagePoint, int]]

Get the region of interest clipped in the image and the information to know if it’s a clipped point.

Warning

Suppose that changeFrame() and computePolygonClipped() have already been called.

Parameters:
cam

camera parameters.

Returns:

A tuple containing:

  • roi: image point corresponding to the region of interest with clipping information.

  1. getRoiClipped(self: visp._visp.core.Polygon3D, cam: visp._visp.core.CameraParameters, cMo: visp._visp.core.HomogeneousMatrix) -> list[tuple[visp._visp.core.ImagePoint, int]]

Get the region of interest clipped in the image and the information to know if it’s a clipped point.

Parameters:
cam

camera parameters.

cMo

pose.

Returns:

A tuple containing:

  • roi: image point corresponding to the region of interest with clipping information.

static roiInsideImage(I: visp._visp.core.ImageGray, corners: list[visp._visp.core.ImagePoint]) bool

Static method to check whether the region defined by the vector of image point is contained entirely in the image.

Parameters:
I: visp._visp.core.ImageGray

The image used for its size.

corners: list[visp._visp.core.ImagePoint]

The vector of points defining a region

setClipping(self, flags: int) None

Specify which clipping to use.

Note

See vpPolygon3DClipping

Parameters:
flags: int

New clipping flags.

setFarClippingDistance(self, dist: float) None

Set the far distance for clipping.

Parameters:
dist: float

Far clipping value.

setNbPoint(self, nb: int) None

Set the number of points which are the corners of the polygon.

Parameters:
nb: int

The number of corners.

setNearClippingDistance(self, dist: float) None

Set the near distance for clipping.

Parameters:
dist: float

Near clipping value.