ImFusion SDK 4.3
ImFusion::OpenCV Namespace Reference

Conversion between ImFusion and OpenCV image containers. More...

Detailed Description

Conversion between ImFusion and OpenCV image containers.

Functions

bool convert (MemImage *imgIn, cv::Mat &matOut, bool container=true)
 Convert 2D image to OpenCV, possibly in container mode Warning: Container mode does not support correctly colored images (RGB vs BGR)
 
cv::Mat convert (MemImage *img, bool container=true)
 
std::unique_ptr< TypedImage< double > > convert (cv::Mat &matIn)
 
std::unique_ptr< MemImageconvert (cv::Mat &matIn, std::optional< PixelType > targetType, bool convertBGR2RGB=true)
 Converts an OpenCV image to a MemImage.
 
int type (const Image *desc)
 Get OpenCV data type from ImFusion type and channels.
 
std::vector< cv::Point2f > convertToPoint2fVector (const std::vector< vec2f > &p)
 
std::vector< cv::Point2d > convertToPoint2dVector (const std::vector< vec2f > &p)
 
std::vector< cv::Point2f > convertToPoint2fVector (const std::vector< vec2 > &p)
 
std::vector< cv::Point2d > convertToPoint2dVector (const std::vector< vec2 > &p)
 
std::vector< cv::Point3f > convertToPoint3fVector (const std::vector< vec3f > &p)
 
std::vector< cv::Point3d > convertToPoint3dVector (const std::vector< vec3f > &p)
 
std::vector< cv::Point3f > convertToPoint3fVector (const std::vector< vec3 > &p)
 
std::vector< cv::Point3d > convertToPoint3dVector (const std::vector< vec3 > &p)
 
std::vector< vec2 > convertFromPoint2fVector (const std::vector< cv::Point2f > &p)
 
std::vector< vec2 > convertFromPoint2dVector (const std::vector< cv::Point2d > &p)
 
std::vector< vec3 > convertFromPoint3fVector (const std::vector< cv::Point3f > &p)
 
std::vector< vec3 > convertFromPoint3dVector (const std::vector< cv::Point3d > &p)
 
std::shared_ptr< GlDenseDeformationconvertOpenCVDistortionToDeformation (const Image &imgDesc, const std::array< double, 5 > &distCoeffs, const mat3 &Kin, const mat3 &Kout, bool rescaleByExtent=true, bool flipY=false)
 Converts OpenCV undistort map to GlDenseDeformation.
 
std::shared_ptr< GlDenseDeformationconvertOpenCVDistortionToInverseDeformation (int width, int height, const std::array< double, 5 > &distCoeffs, const mat3 &Kin, bool flipY=false)
 Obtains a deformation field to model camera distortion using OpenCV.
 

Function Documentation

◆ convert()

std::unique_ptr< MemImage > convert ( cv::Mat & matIn,
std::optional< PixelType > targetType,
bool convertBGR2RGB = true )

Converts an OpenCV image to a MemImage.

Parameters
matInThe input image
targetTypeThe PixelType the returned image should have, if not given a target format is chosen that matches the pixel format of matIn. (default is std::nullopt)
convertBGR2RGBOnly for three-channel color images: whether to convert the OpenCV-default BGR format to the RGB format used in MemImage (default is true)
Returns
a new MemImage

◆ convertOpenCVDistortionToDeformation()

std::shared_ptr< GlDenseDeformation > convertOpenCVDistortionToDeformation ( const Image & imgDesc,
const std::array< double, 5 > & distCoeffs,
const mat3 & Kin,
const mat3 & Kout,
bool rescaleByExtent = true,
bool flipY = false )

Converts OpenCV undistort map to GlDenseDeformation.

See also
cv::initUndistortRectifyMap If
Parameters
rescaleByExtentis false, output deformation is in pixel coordinates. Otherwise output deformation is in pixel coordinates component wise divided by extent of
imgDesc.
flipYdetermins whether to flip the Y coordinate from OpenCV representation

◆ convertOpenCVDistortionToInverseDeformation()

std::shared_ptr< GlDenseDeformation > convertOpenCVDistortionToInverseDeformation ( int width,
int height,
const std::array< double, 5 > & distCoeffs,
const mat3 & Kin,
bool flipY = false )

Obtains a deformation field to model camera distortion using OpenCV.

Parameters
distCoeffsare OpenCV-style distortion coefficients
Kinis the camera matrix (onto pixel coordinates).
flipYdetermins whether to flip the Y coordinate from OpenCV representation
See also
cv::initUndistortRectifyMap Warning: output deformation is in pixel coordinates.
Search Tab / S to search, Esc to close