| 98 | } |
| 99 | |
| 100 | FeatureKeypoints FeatureKeypointsFromBlob(const FeatureKeypointsBlob& blob) { |
| 101 | FeatureKeypoints keypoints(static_cast<size_t>(blob.rows())); |
| 102 | if (blob.rows() == 0) { |
| 103 | return keypoints; |
| 104 | } else if (blob.cols() == 2) { |
| 105 | for (FeatureKeypointsBlob::Index i = 0; i < blob.rows(); ++i) { |
| 106 | keypoints[i] = FeatureKeypoint(blob(i, 0), blob(i, 1)); |
| 107 | } |
| 108 | } else if (blob.cols() == 4) { |
| 109 | for (FeatureKeypointsBlob::Index i = 0; i < blob.rows(); ++i) { |
| 110 | keypoints[i] = |
| 111 | FeatureKeypoint(blob(i, 0), blob(i, 1), blob(i, 2), blob(i, 3)); |
| 112 | } |
| 113 | } else if (blob.cols() == 6) { |
| 114 | for (FeatureKeypointsBlob::Index i = 0; i < blob.rows(); ++i) { |
| 115 | keypoints[i] = FeatureKeypoint(blob(i, 0), |
| 116 | blob(i, 1), |
| 117 | blob(i, 2), |
| 118 | blob(i, 3), |
| 119 | blob(i, 4), |
| 120 | blob(i, 5)); |
| 121 | } |
| 122 | } else { |
| 123 | LOG(FATAL_THROW) << "Keypoint format not supported"; |
| 124 | } |
| 125 | return keypoints; |
| 126 | } |
| 127 | |
| 128 | FeatureMatchesBlob FeatureMatchesToBlob(const FeatureMatches& matches) { |
| 129 | const FeatureMatchesBlob::Index kNumCols = 2; |
no test coverage detected