Unverified Commit d442856f authored by Ayush Garg's avatar Ayush Garg Committed by GitHub

Merge pull request #2447 from ayushgargdroid:kinfuParams

* Adding constructor for kinfu_Params(). Allows users to configure parameters for KinFu Algorithm

* Trailing whitespace correct

* Add constructor for TSDF Initial Pose. Allowed parameters are Matx33f,Vec3f and Matx44f. Also added function setInitialVolumePose to handle Matx44f param data type.
parent 80deee64
......@@ -17,9 +17,49 @@ namespace kinfu {
struct CV_EXPORTS_W Params
{
/** @brief Default parameters
A set of parameters which provides better model quality, can be very slow.
*/
CV_WRAP Params(){}
/**
* @brief Constructor for Params
* Sets the initial pose of the TSDF volume.
* @param volumeIntialPoseRot rotation matrix
* @param volumeIntialPoseTransl translation vector
*/
CV_WRAP Params(Matx33f volumeIntialPoseRot, Vec3f volumeIntialPoseTransl)
{
setInitialVolumePose(volumeIntialPoseRot,volumeIntialPoseTransl);
}
/**
* @brief Constructor for Params
* Sets the initial pose of the TSDF volume.
* @param volumeIntialPose 4 by 4 Homogeneous Transform matrix to set the intial pose of TSDF volume
*/
CV_WRAP Params(Matx44f volumeIntialPose)
{
setInitialVolumePose(volumeIntialPose);
}
/**
* @brief Set Initial Volume Pose
* Sets the initial pose of the TSDF volume.
* @param R rotation matrix
* @param t translation vector
*/
CV_WRAP void setInitialVolumePose(Matx33f R, Vec3f t);
/**
* @brief Set Initial Volume Pose
* Sets the initial pose of the TSDF volume.
* @param homogen_tf 4 by 4 Homogeneous Transform matrix to set the intial pose of TSDF volume
*/
CV_WRAP void setInitialVolumePose(Matx44f homogen_tf);
/**
* @brief Default parameters
* A set of parameters which provides better model quality, can be very slow.
*/
CV_WRAP static Ptr<Params> defaultParams();
/** @brief Coarse parameters
......@@ -32,7 +72,7 @@ struct CV_EXPORTS_W Params
CV_PROP_RW Size frameSize;
/** @brief camera intrinsics */
CV_PROP Matx33f intr;
CV_PROP_RW Matx33f intr;
/** @brief pre-scale per 1 meter for input values
......@@ -93,14 +133,14 @@ struct CV_EXPORTS_W Params
// float gradient_delta_factor;
/** @brief light pose for rendering in meters */
CV_PROP Vec3f lightPose;
CV_PROP_RW Vec3f lightPose;
/** @brief distance theshold for ICP in meters */
CV_PROP_RW float icpDistThresh;
/** angle threshold for ICP in radians */
CV_PROP_RW float icpAngleThresh;
/** number of ICP iterations for each pyramid level */
CV_PROP std::vector<int> icpIterations;
CV_PROP_RW std::vector<int> icpIterations;
/** @brief Threshold for depth truncation in meters
......
......@@ -12,6 +12,16 @@
namespace cv {
namespace kinfu {
void Params::setInitialVolumePose(Matx33f R, Vec3f t)
{
setInitialVolumePose(Affine3f(R,t).matrix);
}
void Params::setInitialVolumePose(Matx44f homogen_tf)
{
Params::volumePose.matrix = homogen_tf;
}
Ptr<Params> Params::defaultParams()
{
Params p;
......@@ -299,6 +309,8 @@ void KinFuImpl<T>::getNormals(InputArray points, OutputArray normals) const
Ptr<KinFu> KinFu::create(const Ptr<Params>& params)
{
CV_Assert((int)params->icpIterations.size() == params->pyramidLevels);
CV_Assert(params->intr(0,1) == 0 && params->intr(1,0) == 0 && params->intr(2,0) == 0 && params->intr(2,1) == 0 && params->intr(2,2) == 1);
#ifdef HAVE_OPENCL
if(cv::ocl::useOpenCL())
return makePtr< KinFuImpl<UMat> >(*params);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment