OpenCV 5.1.0-dev
Open Source Computer Vision
Loading...
Searching...
No Matches
RGB-D and Volumetric Reconstruction

Detailed Description

Classes

class  cv::Odometry
 
class  cv::OdometryFrame
 An object that keeps per-frame data for Odometry algorithms from user-provided images to algorithm-specific precalculated data. When not empty, it contains a depth image, a mask of valid pixels and a set of pyramids generated from that data. A BGR/Gray image and normals are optional. OdometryFrame is made to be used together with Odometry class to reuse precalculated data between Rt data calculations. A correct way to do that is to call Odometry::prepareFrames() on prev and next frames and then pass them to Odometry::compute() method. More...
 
class  cv::OdometrySettings
 
class  cv::RgbdNormals
 
class  cv::Volume
 
class  cv::VolumeSettings
 

Enumerations

enum class  cv::OdometryAlgoType {
  cv::OdometryAlgoType::COMMON = 0 ,
  cv::OdometryAlgoType::FAST = 1
}
 
enum  cv::OdometryFramePyramidType {
  cv::PYR_IMAGE = 0 ,
  cv::PYR_DEPTH = 1 ,
  cv::PYR_MASK = 2 ,
  cv::PYR_CLOUD = 3 ,
  cv::PYR_DIX = 4 ,
  cv::PYR_DIY = 5 ,
  cv::PYR_TEXMASK = 6 ,
  cv::PYR_NORM = 7 ,
  cv::PYR_NORMMASK = 8 ,
  cv::N_PYRAMIDS
}
 
enum class  cv::OdometryType {
  cv::OdometryType::DEPTH = 0 ,
  cv::OdometryType::RGB = 1 ,
  cv::OdometryType::RGB_DEPTH = 2
}
 
enum  cv::RgbdPlaneMethod { cv::RGBD_PLANE_METHOD_DEFAULT }
 
enum class  cv::VolumeType {
  cv::VolumeType::TSDF = 0 ,
  cv::VolumeType::HashTSDF = 1 ,
  cv::VolumeType::ColorTSDF = 2
}
 

Functions

void cv::depthTo3d (InputArray depth, InputArray K, OutputArray points3d, InputArray mask=noArray())
 
void cv::depthTo3dSparse (InputArray depth, InputArray in_K, InputArray in_points, OutputArray points3d)
 
void cv::findPlanes (InputArray points3d, InputArray normals, OutputArray mask, OutputArray plane_coefficients, int block_size=40, int min_size=40 *40, double threshold=0.01, double sensor_error_a=0, double sensor_error_b=0, double sensor_error_c=0, RgbdPlaneMethod method=RGBD_PLANE_METHOD_DEFAULT)
 
void cv::registerDepth (InputArray unregisteredCameraMatrix, InputArray registeredCameraMatrix, InputArray registeredDistCoeffs, InputArray Rt, InputArray unregisteredDepth, const Size &outputImagePlaneSize, OutputArray registeredDepth, bool depthDilation=false)
 
void cv::rescaleDepth (InputArray in, int type, OutputArray out, double depth_factor=1000.0)
 
void cv::warpFrame (InputArray depth, InputArray image, InputArray mask, InputArray Rt, InputArray cameraMatrix, OutputArray warpedDepth=noArray(), OutputArray warpedImage=noArray(), OutputArray warpedMask=noArray())
 

Enumeration Type Documentation

◆ OdometryAlgoType

enum class cv::OdometryAlgoType
strong

#include <opencv2/ptcloud/odometry.hpp>

These constants are used to set the speed and accuracy of odometry

Parameters
COMMONaccurate but not so fast
FASTless accurate but faster
Enumerator
COMMON 
FAST 

◆ OdometryFramePyramidType

#include <opencv2/ptcloud/odometry_frame.hpp>

Indicates what pyramid is to access using getPyramidAt() method:

Enumerator
PYR_IMAGE 
Python: cv.PYR_IMAGE

The pyramid of grayscale images.

PYR_DEPTH 
Python: cv.PYR_DEPTH

The pyramid of depth images.

PYR_MASK 
Python: cv.PYR_MASK

The pyramid of masks.

PYR_CLOUD 
Python: cv.PYR_CLOUD

The pyramid of point clouds, produced from the pyramid of depths.

PYR_DIX 
Python: cv.PYR_DIX

The pyramid of dI/dx derivative images.

PYR_DIY 
Python: cv.PYR_DIY

The pyramid of dI/dy derivative images.

PYR_TEXMASK 
Python: cv.PYR_TEXMASK

The pyramid of "textured" masks (i.e. additional masks for normals or grayscale images)

PYR_NORM 
Python: cv.PYR_NORM

The pyramid of normals.

PYR_NORMMASK 
Python: cv.PYR_NORMMASK

The pyramid of normals masks.

N_PYRAMIDS 
Python: cv.N_PYRAMIDS

◆ OdometryType

enum class cv::OdometryType
strong

#include <opencv2/ptcloud/odometry.hpp>

These constants are used to set a type of data which odometry will use

Parameters
DEPTHonly depth data
RGBonly rgb image
RGB_DEPTHdepth and rgb data simultaneously
Enumerator
DEPTH 
RGB 
RGB_DEPTH 

◆ RgbdPlaneMethod

#include <opencv2/ptcloud/depth.hpp>

Enumerator
RGBD_PLANE_METHOD_DEFAULT 
Python: cv.RGBD_PLANE_METHOD_DEFAULT

◆ VolumeType

enum class cv::VolumeType
strong

#include <opencv2/ptcloud/volume_settings.hpp>

Enumerator
TSDF 
HashTSDF 
ColorTSDF 

Function Documentation

◆ depthTo3d()

void cv::depthTo3d ( InputArray depth,
InputArray K,
OutputArray points3d,
InputArray mask = noArray() )
Python:
cv.depthTo3d(depth, K[, points3d[, mask]]) -> points3d

#include <opencv2/ptcloud/depth.hpp>

Converts a depth image to 3d points. If the mask is empty then the resulting array has the same dimensions as depth, otherwise it is 1d vector containing mask-enabled values only. The coordinate system is x pointing left, y down and z away from the camera

Parameters
depththe depth image (if given as short int CV_U, it is assumed to be the depth in millimeters (as done with the Microsoft Kinect), otherwise, if given as CV_32F or CV_64F, it is assumed in meters)
KThe calibration matrix
points3dthe resulting 3d points (point is represented by 4 channels value [x, y, z, 0]). They are of the same depth as depth if it is CV_32F or CV_64F, and the depth of K if depth is of depth CV_16U or CV_16S
maskthe mask of the points to consider (can be empty)

◆ depthTo3dSparse()

void cv::depthTo3dSparse ( InputArray depth,
InputArray in_K,
InputArray in_points,
OutputArray points3d )
Python:
cv.depthTo3dSparse(depth, in_K, in_points[, points3d]) -> points3d

#include <opencv2/ptcloud/depth.hpp>

Parameters
depththe depth image
in_K
in_pointsthe list of xy coordinates
points3dthe resulting 3d points (point is represented by 4 chanels value [x, y, z, 0])

◆ findPlanes()

void cv::findPlanes ( InputArray points3d,
InputArray normals,
OutputArray mask,
OutputArray plane_coefficients,
int block_size = 40,
int min_size = 40 *40,
double threshold = 0.01,
double sensor_error_a = 0,
double sensor_error_b = 0,
double sensor_error_c = 0,
RgbdPlaneMethod method = RGBD_PLANE_METHOD_DEFAULT )
Python:
cv.findPlanes(points3d, normals[, mask[, plane_coefficients[, block_size[, min_size[, threshold[, sensor_error_a[, sensor_error_b[, sensor_error_c[, method]]]]]]]]]) -> mask, plane_coefficients

#include <opencv2/ptcloud/depth.hpp>

Find the planes in a depth image

Parameters
points3dthe 3d points organized like the depth image: rows x cols with 3 channels
normalsthe normals for every point in the depth image; optional, can be empty
maskAn image where each pixel is labeled with the plane it belongs to and 255 if it does not belong to any plane
plane_coefficientsthe coefficients of the corresponding planes (a,b,c,d) such that ax+by+cz+d=0, norm(a,b,c)=1 and c < 0 (so that the normal points towards the camera)
block_sizeThe size of the blocks to look at for a stable MSE
min_sizeThe minimum size of a cluster to be considered a plane
thresholdThe maximum distance of a point from a plane to belong to it (in meters)
sensor_error_acoefficient of the sensor error. 0 by default, use 0.0075 for a Kinect
sensor_error_bcoefficient of the sensor error. 0 by default
sensor_error_ccoefficient of the sensor error. 0 by default
methodThe method to use to compute the planes.

◆ registerDepth()

void cv::registerDepth ( InputArray unregisteredCameraMatrix,
InputArray registeredCameraMatrix,
InputArray registeredDistCoeffs,
InputArray Rt,
InputArray unregisteredDepth,
const Size & outputImagePlaneSize,
OutputArray registeredDepth,
bool depthDilation = false )
Python:
cv.registerDepth(unregisteredCameraMatrix, registeredCameraMatrix, registeredDistCoeffs, Rt, unregisteredDepth, outputImagePlaneSize[, registeredDepth[, depthDilation]]) -> registeredDepth

#include <opencv2/ptcloud/depth.hpp>

Registers depth data to an external camera Registration is performed by creating a depth cloud, transforming the cloud by the rigid body transformation between the cameras, and then projecting the transformed points into the RGB camera.

uv_rgb = K_rgb * [R | t] * z * inv(K_ir) * uv_ir

Currently does not check for negative depth values.

Parameters
unregisteredCameraMatrixthe camera matrix of the depth camera
registeredCameraMatrixthe camera matrix of the external camera
registeredDistCoeffsthe distortion coefficients of the external camera
Rtthe rigid body transform between the cameras. Transforms points from depth camera frame to external camera frame.
unregisteredDepththe input depth data
outputImagePlaneSizethe image plane dimensions of the external camera (width, height)
registeredDepththe result of transforming the depth into the external camera
depthDilationwhether or not the depth is dilated to avoid holes and occlusion errors (optional)

◆ rescaleDepth()

void cv::rescaleDepth ( InputArray in,
int type,
OutputArray out,
double depth_factor = 1000.0 )
Python:
cv.rescaleDepth(in_, type[, out[, depth_factor]]) -> out

#include <opencv2/ptcloud/depth.hpp>

If the input image is of type CV_16UC1 (like the Kinect one), the image is converted to floats, divided by depth_factor to get a depth in meters, and the values 0 are converted to std::numeric_limits<float>::quiet_NaN() Otherwise, the image is simply converted to floats

Parameters
inthe depth image (if given as short int CV_U, it is assumed to be the depth in millimeters (as done with the Microsoft Kinect), it is assumed in meters)
typethe desired output depth (CV_32F or CV_64F)
outThe rescaled float depth image
depth_factor(optional) factor by which depth is converted to distance (by default = 1000.0 for Kinect sensor)

◆ warpFrame()

void cv::warpFrame ( InputArray depth,
InputArray image,
InputArray mask,
InputArray Rt,
InputArray cameraMatrix,
OutputArray warpedDepth = noArray(),
OutputArray warpedImage = noArray(),
OutputArray warpedMask = noArray() )
Python:
cv.warpFrame(depth, image, mask, Rt, cameraMatrix[, warpedDepth[, warpedImage[, warpedMask]]]) -> warpedDepth, warpedImage, warpedMask

#include <opencv2/ptcloud/depth.hpp>

Warps depth or RGB-D image by reprojecting it in 3d, applying Rt transformation and then projecting it back onto the image plane. This function can be used to visualize the results of the Odometry algorithm.

Parameters
depthDepth data, should be 1-channel CV_16U, CV_16S, CV_32F or CV_64F
imageRGB image (optional), should be 1-, 3- or 4-channel CV_8U
maskMask of used pixels (optional), should be CV_8UC1, CV_8SC1 or CV_BoolC1
RtRotation+translation matrix (3x4 or 4x4) to be applied to depth points
cameraMatrixCamera intrinsics matrix (3x3)
warpedDepthThe warped depth data (optional)
warpedImageThe warped RGB image (optional)
warpedMaskThe mask of valid pixels in warped image (optional)