added sobel kernel for image gradient calcualtion

This commit is contained in:
2019-05-31 11:38:49 +02:00
parent 5d36a123a7
commit 2a16fb2fc5
8 changed files with 60 additions and 3 deletions

View File

@ -1312,8 +1312,13 @@ void MsckfVio::PhotometricMeasurementJacobian(
// calculate derivation for anchor frame, use position for derivation calculation
// frame derivative calculated convoluting with kernel [-1, 0, 1]
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);
dx = feature.Kernel(p_in_anchor, anchor_frame, "Sobel_x");
dy = feature.Kernel(p_in_anchor, anchor_frame, "Sobel_y");
// 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);