Skip to content

Eigen Matrix3d issue in  #4

@mpottinger

Description

@mpottinger

Hello, I am trying to adapt the
register_convert(depth_frame color_frame) code to my own program to register depth to color, not with ROS.

However I am running into the following error when the Matrix3d rot is being initialized:
/usr/include/eigen3/Eigen/src/Core/DenseCoeffsBase.h:365: Eigen::DenseCoeffsBase<Derived, 1>::Scalar& Eigen::DenseCoeffsBase<Derived, 1>::operator()(Eigen::Index, Eigen::Index) [with Derived = Eigen::Matrix<double, 3, 3>; Eigen::DenseCoeffsBase<Derived, 1>::Scalar = double; Eigen::Index = long int]: Assertion `row >= 0 && row < rows() && col >= 0 && col < cols()' failed.

Error occurs at this point in register.hpp when i or j is greater than 3:
It appears that Eigen::Matrix3d isn't large enough to hold all values from ST::Matrix4 pose.

I am very new to this, but I am very confused how this code has worked for you and not for me.
if I change the condition to i < 3 j < 3 instead, I don't get an error. I haven't tried viewing the resulting depth data from that yet, and I will try. However this is still puzzling why it does not work as originally written.

Eigen::Matrix3d rot;
const ST::Matrix4 pose = depth_frame.visibleCameraPoseInDepthCoordinateFrame();
for(size_t j = 0; j < 4; j++)
  {
      std::cout << "   j:" << j << "\n";
      for(size_t i = 0; i < 4; i++){
            **rot(j, i) = pose.atRowCol(j, i);**  // Error occurs here when i > 3;
      }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions