Skip to content

Commit

Permalink
Make class member variables locals where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
James Ward committed Nov 13, 2019
1 parent 8d80abd commit ac9c905
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
7 changes: 0 additions & 7 deletions include/cam_lidar_calibration/optimiser.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,6 @@ class Optimiser
double reprojectionCost(const RotationTranslation& rot_trans);
double centreAlignmentCost(const RotationTranslation& rot_trans);

cv::Mat camera_normals_;
cv::Mat camera_centres_;
cv::Mat lidar_centres_;
cv::Mat lidar_normals_;
cv::Mat lidar_corners_;
cv::Mat pixel_errors_;

Rotation eul;
RotationTranslation eul_t, eul_it;
initial_parameters_t i_params;
Expand Down
12 changes: 4 additions & 8 deletions src/optimiser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,10 @@ bool Optimiser::optimise()
ROS_INFO_STREAM("Lidar corner:" << c);
}
}
camera_normals_ = cv::Mat(n, 3, CV_64F);
camera_centres_ = cv::Mat(n, 3, CV_64F);
lidar_centres_ = cv::Mat(n, 3, CV_64F);
lidar_normals_ = cv::Mat(n, 3, CV_64F);
lidar_corners_ = cv::Mat(n, 3, CV_64F);
pixel_errors_ = cv::Mat(1, n, CV_64F);
auto camera_normals_ = cv::Mat(n, 3, CV_64F);
auto camera_centres_ = cv::Mat(n, 3, CV_64F);
auto lidar_centres_ = cv::Mat(n, 3, CV_64F);
auto lidar_normals_ = cv::Mat(n, 3, CV_64F);

// Insert vector elements into cv::Mat for easy matrix operation
int row = 0;
Expand All @@ -327,8 +325,6 @@ bool Optimiser::optimise()
ln.copyTo(lidar_normals_.row(row));
cv::Mat lc = cv::Mat(sample.lidar_centre).reshape(1).t();
lc.copyTo(lidar_centres_.row(row));
cv::Mat l_cn = cv::Mat(sample.lidar_corners[2]).reshape(1).t();
l_cn.copyTo(lidar_corners_.row(row));
row++;
}
cv::Mat NN = camera_normals_.t() * camera_normals_;
Expand Down

0 comments on commit ac9c905

Please sign in to comment.