| 43 | namespace { |
| 44 | |
| 45 | void ScaleKeypoints(int bitmap_width, |
| 46 | int bitmap_height, |
| 47 | size_t camera_width, |
| 48 | size_t camera_height, |
| 49 | FeatureKeypoints* keypoints) { |
| 50 | if (static_cast<size_t>(bitmap_width) != camera_width || |
| 51 | static_cast<size_t>(bitmap_height) != camera_height) { |
| 52 | const float scale_x = static_cast<float>(camera_width) / bitmap_width; |
| 53 | const float scale_y = static_cast<float>(camera_height) / bitmap_height; |
| 54 | for (auto& keypoint : *keypoints) { |
| 55 | keypoint.Rescale(scale_x, scale_y); |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | void MaskFeatures(const Bitmap& mask, |
| 61 | FeatureKeypoints* keypoints, |