![]() |
ImFusion C++ SDK 4.5.0
|
Conversion between ImFusion and OpenCV image containers and primitives. More...
Conversion between ImFusion and OpenCV image containers and primitives.
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< MemImage > | convert (cv::Mat &matIn, std::optional< PixelType > targetType, bool convertBGR2RGB=true) |
| Converts an OpenCV image to a MemImage. | |
| std::optional< mat4 > | convert (const cv::Mat &rotation, const cv::Mat &translation) |
| Converts an OpenCV pose representation (rotation and translation) into a homogeneous SE(3) transform (4x4). | |
| bool | convert (const mat4 &se3Transform, cv::Mat &rvecOut, cv::Mat &tvecOut) |
| Converts a homogeneous SE(3) transform (4x4) into OpenCV pose parameters (Rodrigues rvec and translation tvec). | |
| 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< 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. | |
| 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. | |
| std::unique_ptr< MemImage > ImFusion::OpenCV::convert | ( | cv::Mat & | matIn, |
| std::optional< PixelType > | targetType, | ||
| bool | convertBGR2RGB = true ) |
Converts an OpenCV image to a MemImage.
| matIn | The input image |
| targetType | The 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) |
| convertBGR2RGB | Only for three-channel color images: whether to convert the OpenCV-default BGR format to the RGB format used in MemImage (default is true) |
| std::optional< mat4 > ImFusion::OpenCV::convert | ( | const cv::Mat & | rotation, |
| const cv::Mat & | translation ) |
Converts an OpenCV pose representation (rotation and translation) into a homogeneous SE(3) transform (4x4).
This function accepts a rotation either as a 3x3 rotation matrix \(R\) or as a Rodrigues rotation vector \(\omega\) (3x1 or 1x3). The translation must be a 3-element vector (3x1 or 1x3).
rotation is provided as a Rodrigues vector, it is converted to a 3x3 rotation matrix via cv::Rodrigues(). translation is provided as a row vector (1x3), it is transposed internally to match a column vector.| rotation | Rotation as either:
|
| translation | Translation vector (shape 3x1 or 1x3). Must be single-channel CV_32F or CV_64F. |
| bool ImFusion::OpenCV::convert | ( | const mat4 & | se3Transform, |
| cv::Mat & | rvecOut, | ||
| cv::Mat & | tvecOut ) |
Converts a homogeneous SE(3) transform (4x4) into OpenCV pose parameters (Rodrigues rvec and translation tvec).
| se3Transform | Homogeneous 4x4 transform. The top-left 3x3 block is interpreted as rotation, and the top-right 3x1 block as translation. |
| rvecOut | Output Rodrigues rotation vector, a 3x1 CV_64F matrix |
| tvecOut | Output translation vector, a 3x1 CV_64F matrix. |
| std::shared_ptr< GlDenseDeformation > ImFusion::OpenCV::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.
| rescaleByExtent | is false, output deformation is in pixel coordinates. Otherwise output deformation is in pixel coordinates component wise divided by extent of |
| imgDesc. | |
| flipY | determins whether to flip the Y coordinate from OpenCV representation |
| std::shared_ptr< GlDenseDeformation > ImFusion::OpenCV::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.
| distCoeffs | are OpenCV-style distortion coefficients |
| Kin | is the camera matrix (onto pixel coordinates). |
| flipY | determins whether to flip the Y coordinate from OpenCV representation |