Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moved undistorter to cameras and added point processing function #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

floriantschopp
Copy link
Contributor

@floriantschopp floriantschopp commented Jan 24, 2019

For some reason aslam_cv_pipeline/src/undistorter-mapped.cc -> aslam_cv_cameras/src/undistorter-mapped.cc is not detected

Copy link
Contributor

@mfehr mfehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did a pass through the PR, looks good, except maybe the duplication of the undistortion map might not be necessary?

@@ -107,16 +107,32 @@ class NCamera {
/// Get the geometry object for camera i.
const Camera& getCamera(size_t camera_index) const;

/// Get the geometry object for camera i.
/// The method will assert that the camera is not in the rig!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that the camera IS in the rig?

/// Get the geometry object for camera i.
Camera& getCameraMutable(size_t camera_index);

/// Get the geometry object for camera i.
/// The method will assert that the camera is not in the rig!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and below

@@ -70,8 +70,7 @@ inline std::unique_ptr<MappedUndistorter> createMappedUndistorter(
input_camera);
CHECK(unified_proj_cam_ptr != nullptr)
<< "Cast to unified projection camera failed.";
intrinsics << unified_proj_cam_ptr->xi(), output_camera_matrix(0, 0),
output_camera_matrix(1, 1), output_camera_matrix(0, 2),
output_camera_matrix(1, 1), output_camera_matrix(0, 2),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems fishy, is there a line missing here?

return std::unique_ptr<MappedUndistorter>(new MappedUndistorter(
input_camera, output_camera, map_u, map_v, interpolation_type));
// Convert map to non-fixed point representation for easy lookup of values.
cv::Mat map_u_float = map_u.clone();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it make sense to clone the cv::Mat and then later I guess you just overwrite everything again or even reallocate them? Why not initialize them to the right size and type here or inside the function?

// Convert map to non-fixed point representation for easy lookup of values.
cv::Mat map_u_float = map_u.clone();
cv::Mat map_v_float = map_v.clone();
aslam::convertMapsLegacy(map_u, map_v, map_u_float, map_v_float, CV_32FC1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to use a legacy function in this core functionality? Is this reverting the map convention to legacy?

@@ -69,13 +69,21 @@ class MappedUndistorter : public Undistorter {
/// \param[in] interpolation Interpolation method used for undistortion.
/// (\ref InterpolationMethod)
MappedUndistorter(aslam::Camera::Ptr input_camera, aslam::Camera::Ptr output_camera,
const cv::Mat& map_u, const cv::Mat& map_v, InterpolationMethod interpolation);
const cv::Mat& map_u, const cv::Mat& map_v,
const cv::Mat& map_u_float, const cv::Mat& map_v_float,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this now take both the fixed point maps and the float map? Shouldn't it only need one of the two?

CHECK_LE((*point)[0], map_u_.cols);
CHECK_LE((*point)[1], map_v_.rows);
*point = Eigen::Vector2d(
map_u_float_.at<float>((*point)[1], (*point)[0]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to be the only reason we have the float maps now, right? Would it be that expensive to do this using the fixed point map?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants