MCPcopy Create free account
hub / github.com/colmap/colmap / ReadAndShowWithKeypoints

Method ReadAndShowWithKeypoints

src/colmap/ui/image_viewer_widget.cc:172–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172void FeatureImageViewerWidget::ReadAndShowWithKeypoints(
173 const std::filesystem::path& path,
174 const FeatureKeypoints& keypoints,
175 const std::vector<char>& tri_mask) {
176 Bitmap bitmap;
177 if (!bitmap.Read(path, /*as_rgb=*/true)) {
178 LOG(ERROR) << "Cannot read image at path " << path;
179 return;
180 }
181
182 image1_ = QPixmap::fromImage(BitmapToQImageRGB(bitmap));
183 image2_ = image1_;
184
185 const size_t num_tri_keypoints = std::count_if(
186 tri_mask.begin(), tri_mask.end(), [](const bool tri) { return tri; });
187
188 FeatureKeypoints keypoints_tri(num_tri_keypoints);
189 FeatureKeypoints keypoints_not_tri(keypoints.size() - num_tri_keypoints);
190 size_t idx_tri = 0;
191 size_t idx_not_tri = 0;
192 for (size_t i = 0; i < tri_mask.size(); ++i) {
193 if (tri_mask[i]) {
194 keypoints_tri[idx_tri++] = keypoints[i];
195 } else {
196 keypoints_not_tri[idx_not_tri++] = keypoints[i];
197 }
198 }
199
200 DrawKeypoints(&image2_, keypoints_tri, Qt::magenta);
201 DrawKeypoints(&image2_, keypoints_not_tri, Qt::red);
202
203 if (switch_state_) {
204 ShowPixmap(image2_);
205 } else {
206 ShowPixmap(image1_);
207 }
208}
209
210void FeatureImageViewerWidget::ReadAndShowWithMatches(
211 const std::filesystem::path& path1,

Callers 1

ShowImageMethod · 0.80

Calls 6

BitmapToQImageRGBFunction · 0.85
DrawKeypointsFunction · 0.85
sizeMethod · 0.80
ReadMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected