diff --git a/mediapipe/framework/formats/motion/optical_flow_field.cc b/mediapipe/framework/formats/motion/optical_flow_field.cc index 1e6adef4..a9650419 100644 --- a/mediapipe/framework/formats/motion/optical_flow_field.cc +++ b/mediapipe/framework/formats/motion/optical_flow_field.cc @@ -66,12 +66,12 @@ cv::Mat MakeVisualizationHsv(const cv::Mat_& angles, cv::Mat hsv(angles.size(), CV_8UC3); for (int r = 0; r < hsv.rows; ++r) { for (int c = 0; c < hsv.cols; ++c) { - const uint8 hue = static_cast(255.0f * angles(r, c) / 360.0f); - uint8 saturation = 255; + const uint8_t hue = static_cast(255.0f * angles(r, c) / 360.0f); + uint8_t saturation = 255; if (magnitudes(r, c) < max_mag) { - saturation = static_cast(255.0f * magnitudes(r, c) / max_mag); + saturation = static_cast(255.0f * magnitudes(r, c) / max_mag); } - const uint8 value = 255; + const uint8_t value = 255; hsv.at(r, c) = cv::Vec3b(hue, saturation, value); } @@ -282,7 +282,7 @@ void OpticalFlowField::EstimateMotionConsistencyOcclusions( Location OpticalFlowField::FindMotionInconsistentPixels( const OpticalFlowField& forward, const OpticalFlowField& backward, double spatial_distance_threshold) { - const uint8 kOccludedPixelValue = 1; + const uint8_t kOccludedPixelValue = 1; const double threshold_sq = spatial_distance_threshold * spatial_distance_threshold; cv::Mat occluded = cv::Mat::zeros(forward.height(), forward.width(), CV_8UC1); @@ -301,10 +301,10 @@ Location OpticalFlowField::FindMotionInconsistentPixels( if (!in_bounds_in_next_frame || Point2_f(x - round_trip_x, y - round_trip_y).ToVector().Norm2() > threshold_sq) { - occluded.at(y, x) = kOccludedPixelValue; + occluded.at(y, x) = kOccludedPixelValue; } } } - return CreateCvMaskLocation(occluded); + return CreateCvMaskLocation(occluded); } } // namespace mediapipe diff --git a/mediapipe/framework/formats/motion/optical_flow_field_test.cc b/mediapipe/framework/formats/motion/optical_flow_field_test.cc index 521256c4..fdce418f 100644 --- a/mediapipe/framework/formats/motion/optical_flow_field_test.cc +++ b/mediapipe/framework/formats/motion/optical_flow_field_test.cc @@ -300,15 +300,15 @@ TEST(OpticalFlowField, Occlusions) { for (int y = 0; y < occlusion_mat->rows; ++y) { // Bottom row and pixel at (x, y) = (1, 0) are occluded. if (y == occlusion_mat->rows - 1 || (x == 1 && y == 0)) { - EXPECT_GT(occlusion_mat->at(y, x), 0); + EXPECT_GT(occlusion_mat->at(y, x), 0); } else { - EXPECT_EQ(0, occlusion_mat->at(y, x)); + EXPECT_EQ(0, occlusion_mat->at(y, x)); } // Top row and pixel at (x, y) = (1, 2) are disoccluded. if (y == 0 || (x == 1 && y == 2)) { - EXPECT_GT(disocclusion_mat->at(y, x), 0); + EXPECT_GT(disocclusion_mat->at(y, x), 0); } else { - EXPECT_EQ(0, disocclusion_mat->at(y, x)); + EXPECT_EQ(0, disocclusion_mat->at(y, x)); } } }