From 1b29047451bca3217a5884723dccf02bece8acaa Mon Sep 17 00:00:00 2001 From: g-spacewhale Date: Thu, 13 Jun 2019 18:09:06 +0200 Subject: [PATCH] sobel normalization added --- include/msckf_vio/feature.hpp | 9 ++++++++- src/msckf_vio.cpp | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/msckf_vio/feature.hpp b/include/msckf_vio/feature.hpp index 218157b..6d51e4f 100644 --- a/include/msckf_vio/feature.hpp +++ b/include/msckf_vio/feature.hpp @@ -701,7 +701,11 @@ bool Feature::VisualizeKernel( cv::Mat xderImage2(anchorImage.rows, anchorImage.cols, anchorImage_blurred.type()); cv::Mat yderImage2(anchorImage.rows, anchorImage.cols, anchorImage_blurred.type()); - cv::imshow("xder", abs_xderImage); + + cv::Mat norm_abs_xderImage; + cv::normalize(abs_xderImage, norm_abs_xderImage, 0, 255, cv::NORM_MINMAX, CV_8UC1); + + cv::imshow("xder", norm_abs_xderImage); cv::imshow("yder", abs_yderImage); for(int i = 1; i < anchorImage.rows-1; i++) @@ -1028,6 +1032,9 @@ bool Feature::initializeAnchor(const CameraCalibration& cam, int N) cv::Sobel(anchorImage_deeper, xderImage, -1, 1, 0, 3); cv::Sobel(anchorImage_deeper, yderImage, -1, 0, 1, 3); + xderImage/=8; + yderImage/=8; + cv::convertScaleAbs(xderImage, abs_xderImage); cv::convertScaleAbs(yderImage, abs_yderImage); diff --git a/src/msckf_vio.cpp b/src/msckf_vio.cpp index 5b3c065..0877890 100644 --- a/src/msckf_vio.cpp +++ b/src/msckf_vio.cpp @@ -1320,8 +1320,8 @@ void MsckfVio::PhotometricMeasurementJacobian( // dx = feature.PixelIrradiance(cv::Point2f(p_in_anchor.x+1, p_in_anchor.y), anchor_frame) - feature.PixelIrradiance(cv::Point2f(p_in_anchor.x-1, p_in_anchor.y), anchor_frame); // dy = feature.PixelIrradiance(cv::Point2f(p_in_anchor.x, p_in_anchor.y+1), anchor_frame) - feature.PixelIrradiance(cv::Point2f(p_in_anchor.x, p_in_anchor.y-1), anchor_frame); - dI_dhj(0, 0) = dx/(pixelDistance.x); - dI_dhj(0, 1) = dy/(pixelDistance.y); + dI_dhj(0, 0) = dx;// /(pixelDistance.x); + dI_dhj(0, 1) = dy;// /(pixelDistance.y); gradientVector.x += dx; gradientVector.y += dy; @@ -1424,7 +1424,7 @@ void MsckfVio::PhotometricMeasurementJacobian( { feature.MarkerGeneration(marker_pub, state_server.cam_states); feature.VisualizePatch(cam_state, cam_state_id, cam0, r_photo, ss, gradientVector, residualVector); - // feature.VisualizeKernel(cam_state, cam_state_id, cam0); + feature.VisualizeKernel(cam_state, cam_state_id, cam0); } return;