Skip to content

Commit ab4d80b

Browse files
committed
SIFT continues to produce issues on macos ci
- skip SIFT when OpenCV 4.10.0 corresponding to VISP_HAVE_OPENCV_VERSION=0x040A00 - fix typo around pugixml detection - add verbosity to help debugging
1 parent 8310fcb commit ab4d80b

File tree

4 files changed

+46
-13
lines changed

4 files changed

+46
-13
lines changed

modules/vision/test/keypoint-with-dataset/testKeyPoint-2.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ void run_test(const std::string &env_ipath, bool opt_click_allowed, bool opt_dis
189189
// Load config for tracker
190190
std::string tracker_config_file = vpIoTools::createFilePath(env_ipath, "mbt/cube.xml");
191191

192-
#if defined(VISP_HAVE_PUGYXML)
192+
#if defined(VISP_HAVE_PUGIXML)
193193
tracker.loadConfigFile(tracker_config_file);
194194
tracker.getCameraParameters(cam);
195195
#else

modules/vision/test/keypoint-with-dataset/testKeyPoint-4.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ void run_test(const std::string &env_ipath, bool opt_click_allowed, bool opt_dis
191191
// Load config for tracker
192192
std::string tracker_config_file = vpIoTools::createFilePath(env_ipath, "mbt/cube.xml");
193193

194-
#if defined(VISP_HAVE_PUGYXML)
194+
#if defined(VISP_HAVE_PUGIXML)
195195
tracker.loadConfigFile(tracker_config_file);
196196
tracker.getCameraParameters(cam);
197197
#else

modules/vision/test/keypoint-with-dataset/testKeyPoint-5.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,12 @@ void run_test(const std::string &env_ipath, bool opt_click_allowed, bool opt_dis
218218
(VISP_HAVE_OPENCV_VERSION >= 0x030411 && CV_MAJOR_VERSION < 4) || (VISP_HAVE_OPENCV_VERSION >= 0x040400)
219219
#if (VISP_HAVE_OPENCV_VERSION != 0x040504) && (VISP_HAVE_OPENCV_VERSION != 0x040505) && \
220220
(VISP_HAVE_OPENCV_VERSION != 0x040600) && (VISP_HAVE_OPENCV_VERSION != 0x040700) && \
221-
(VISP_HAVE_OPENCV_VERSION != 0x040900) && (VISP_HAVE_OPENCV_VERSION != 0x041000) && \
221+
(VISP_HAVE_OPENCV_VERSION != 0x040900) && (VISP_HAVE_OPENCV_VERSION != 0x040A00) && \
222222
(defined(__APPLE__) && defined(__MACH__))
223223
// SIFT is known to be unstable with OpenCV 4.5.4 and 4.5.5 on macOS (see #1048)
224224
// Same for OpenCV 4.6.0 (see #1106) where it produces an Illegal Instruction error when OpenCV 4.6.0 is
225225
// installed with brew. It seems working when OpenCV is build from source
226+
std::cout << "-- Add SIFT detector" << std::endl;
226227
detectorNames.push_back("PyramidSIFT");
227228
detectorNames.push_back("SIFT");
228229
#endif
@@ -271,12 +272,13 @@ void run_test(const std::string &env_ipath, bool opt_click_allowed, bool opt_dis
271272
(VISP_HAVE_OPENCV_VERSION >= 0x030411 && CV_MAJOR_VERSION < 4) || (VISP_HAVE_OPENCV_VERSION >= 0x040400)
272273
#if ((VISP_HAVE_OPENCV_VERSION == 0x040504) || (VISP_HAVE_OPENCV_VERSION == 0x040505) || \
273274
(VISP_HAVE_OPENCV_VERSION == 0x040600) || (VISP_HAVE_OPENCV_VERSION == 0x040700) || \
274-
(VISP_HAVE_OPENCV_VERSION == 0x040900) || (VISP_HAVE_OPENCV_VERSION == 0x041000)) && \
275+
(VISP_HAVE_OPENCV_VERSION == 0x040900) || (VISP_HAVE_OPENCV_VERSION == 0x040A00)) && \
275276
(defined(__APPLE__) && defined(__MACH__))
276277
// SIFT is known to be unstable with OpenCV 4.5.4 and 4.5.5 on macOS (see #1048)
277278
// Same for OpenCV 4.6.0 (see #1106) where it produces an Illegal Instruction error when OpenCV 4.6.0 is
278279
// installed with brew. It seems working when OpenCV is build from source
279280
if (i == vpKeyPoint::DETECTOR_SIFT) {
281+
std::cout << "-- Skip SIFT detector" << std::endl;
280282
continue;
281283
}
282284
#endif

modules/vision/test/keypoint-with-dataset/testKeyPoint-7.cpp

+40-9
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ template <typename Type> void run_test(const std::string &env_ipath, const std::
305305

306306
// Test with binary descriptor
307307
{
308+
std::cout << "Detect ORB keypoints" << std::endl;
308309
std::string keypointName = "ORB";
309310
keyPoints.setDetector(keypointName);
310311
keyPoints.setExtractor(keypointName);
@@ -324,6 +325,7 @@ template <typename Type> void run_test(const std::string &env_ipath, const std::
324325
filename = vpIoTools::createFilePath(opath, "bin_with_img");
325326
vpIoTools::makeDirectory(filename);
326327
filename = vpIoTools::createFilePath(filename, "test_save_in_bin_with_img.bin");
328+
std::cout << "Save keypoints in binary with image in: " << filename << std::endl;
327329
keyPoints.saveLearningData(filename, true, true);
328330

329331
// Test if save is ok
@@ -335,18 +337,20 @@ template <typename Type> void run_test(const std::string &env_ipath, const std::
335337

336338
// Test if read is ok
337339
vpKeyPoint read_keypoint1;
338-
340+
std::cout << "Read keypoints from file: " << filename << std::endl;
339341
read_keypoint1.loadLearningData(filename, true);
340342

341343
std::vector<cv::KeyPoint> trainKeyPoints_read;
342344
read_keypoint1.getTrainKeyPoints(trainKeyPoints_read);
343345
cv::Mat trainDescriptors_read = read_keypoint1.getTrainDescriptors();
344346

347+
std::cout << "Compare keypoints" << std::endl;
345348
if (!compareKeyPoints(trainKeyPoints, trainKeyPoints_read)) {
346349
throw vpException(vpException::fatalError, "Problem with trainKeyPoints when reading learning file saved "
347350
"in binary with train images saved !");
348351
}
349352

353+
std::cout << "Compare descriptors" << std::endl;
350354
if (!compareDescriptors(trainDescriptors, trainDescriptors_read)) {
351355
throw vpException(vpException::fatalError, "Problem with trainDescriptors when reading "
352356
"learning file saved in "
@@ -357,6 +361,7 @@ template <typename Type> void run_test(const std::string &env_ipath, const std::
357361
filename = vpIoTools::createFilePath(opath, "bin_without_img");
358362
vpIoTools::makeDirectory(filename);
359363
filename = vpIoTools::createFilePath(filename, "test_save_in_bin_without_img.bin");
364+
std::cout << "Save keypoints in binary without image in: " << filename << std::endl;
360365
keyPoints.saveLearningData(filename, true, false);
361366

362367
// Test if save is ok
@@ -368,27 +373,31 @@ template <typename Type> void run_test(const std::string &env_ipath, const std::
368373

369374
// Test if read is ok
370375
vpKeyPoint read_keypoint2;
376+
std::cout << "Read keypoints from file: " << filename << std::endl;
371377
read_keypoint2.loadLearningData(filename, true);
372378
trainKeyPoints_read.clear();
373379
read_keypoint2.getTrainKeyPoints(trainKeyPoints_read);
374380
trainDescriptors_read = read_keypoint2.getTrainDescriptors();
375381

382+
std::cout << "Compare keypoints" << std::endl;
376383
if (!compareKeyPoints(trainKeyPoints, trainKeyPoints_read)) {
377384
throw vpException(vpException::fatalError, "Problem with trainKeyPoints when reading learning file saved in "
378385
"binary without train images !");
379386
}
380387

388+
std::cout << "Compare descriptors" << std::endl;
381389
if (!compareDescriptors(trainDescriptors, trainDescriptors_read)) {
382390
throw vpException(vpException::fatalError, "Problem with trainDescriptors when reading "
383391
"learning file saved in "
384392
"binary without train images !");
385393
}
386394

387-
#if defined(VISP_HAVE_PUGYXML)
395+
#if defined(VISP_HAVE_PUGIXML)
388396
// Save in xml with training images
389397
filename = vpIoTools::createFilePath(opath, "xml_with_img");
390398
vpIoTools::makeDirectory(filename);
391399
filename = vpIoTools::createFilePath(filename, "test_save_in_xml_with_img.xml");
400+
std::cout << "Save keypoints in xml with image in: " << filename << std::endl;
392401
keyPoints.saveLearningData(filename, false, true);
393402

394403
// Test if save is ok
@@ -400,16 +409,19 @@ template <typename Type> void run_test(const std::string &env_ipath, const std::
400409

401410
// Test if read is ok
402411
vpKeyPoint read_keypoint3;
412+
std::cout << "Read keypoints from file: " << filename << std::endl;
403413
read_keypoint3.loadLearningData(filename, false);
404414
trainKeyPoints_read.clear();
405415
read_keypoint3.getTrainKeyPoints(trainKeyPoints_read);
406416
trainDescriptors_read = read_keypoint3.getTrainDescriptors();
407417

418+
std::cout << "Compare keypoints" << std::endl;
408419
if (!compareKeyPoints(trainKeyPoints, trainKeyPoints_read)) {
409420
throw vpException(vpException::fatalError, "Problem with trainKeyPoints when reading learning file saved in "
410421
"xml with train images saved !");
411422
}
412423

424+
std::cout << "Compare descriptors" << std::endl;
413425
if (!compareDescriptors(trainDescriptors, trainDescriptors_read)) {
414426
throw vpException(vpException::fatalError, "Problem with trainDescriptors when reading "
415427
"learning file saved in "
@@ -420,6 +432,7 @@ template <typename Type> void run_test(const std::string &env_ipath, const std::
420432
filename = vpIoTools::createFilePath(opath, "xml_without_img");
421433
vpIoTools::makeDirectory(filename);
422434
filename = vpIoTools::createFilePath(filename, "test_save_in_xml_without_img.xml");
435+
std::cout << "Save keypoints in xml without image in: " << filename << std::endl;
423436
keyPoints.saveLearningData(filename, false, false);
424437

425438
// Test if save is ok
@@ -433,14 +446,17 @@ template <typename Type> void run_test(const std::string &env_ipath, const std::
433446
vpKeyPoint read_keypoint4;
434447
read_keypoint4.loadLearningData(filename, false);
435448
trainKeyPoints_read.clear();
449+
std::cout << "Read keypoints from file: " << filename << std::endl;
436450
read_keypoint4.getTrainKeyPoints(trainKeyPoints_read);
437451
trainDescriptors_read = read_keypoint4.getTrainDescriptors();
438452

453+
std::cout << "Compare keypoints" << std::endl;
439454
if (!compareKeyPoints(trainKeyPoints, trainKeyPoints_read)) {
440455
throw vpException(vpException::fatalError, "Problem with trainKeyPoints when reading learning file saved in "
441456
"xml without train images saved !");
442457
}
443458

459+
std::cout << "Compare descriptors" << std::endl;
444460
if (!compareDescriptors(trainDescriptors, trainDescriptors_read)) {
445461
throw vpException(vpException::fatalError, "Problem with trainDescriptors when reading "
446462
"learning file saved in "
@@ -457,19 +473,22 @@ template <typename Type> void run_test(const std::string &env_ipath, const std::
457473
{
458474
#if (VISP_HAVE_OPENCV_VERSION != 0x040504) && (VISP_HAVE_OPENCV_VERSION != 0x040505) && \
459475
(VISP_HAVE_OPENCV_VERSION != 0x040600) && (VISP_HAVE_OPENCV_VERSION != 0x040700) && \
460-
(VISP_HAVE_OPENCV_VERSION != 0x040900) && (VISP_HAVE_OPENCV_VERSION != 0x041000) && \
476+
(VISP_HAVE_OPENCV_VERSION != 0x040900) && (VISP_HAVE_OPENCV_VERSION != 0x040A00) && \
461477
(defined(__APPLE__) && defined(__MACH__))
462478
// SIFT is known to be unstable with OpenCV 4.5.4 and 4.5.5 on macOS (see #1048)
463479
// Same for OpenCV 4.6.0 (see #1106) where it produces an Illegal Instruction error when OpenCV 4.6.0 is
464480
// installed with brew. It seems working when OpenCV is build from source
465481
std::string keypointName = "SIFT";
482+
std::cout << "Use " << keypointName << " keypoints" << std::endl;
466483
keyPoints.setDetector(keypointName);
467484
keyPoints.setExtractor(keypointName);
468485

486+
std::cout << "Detect keypoints" << std::endl;
469487
keyPoints.buildReference(I);
470488

471489
std::vector<cv::KeyPoint> trainKeyPoints;
472490
keyPoints.getTrainKeyPoints(trainKeyPoints);
491+
std::cout << "Get descriptors" << std::endl;
473492
cv::Mat trainDescriptors = keyPoints.getTrainDescriptors();
474493
if (trainKeyPoints.empty() || trainDescriptors.empty() || (int)trainKeyPoints.size() != trainDescriptors.rows) {
475494
throw vpException(vpException::fatalError, "Problem when detecting keypoints or when "
@@ -480,6 +499,7 @@ template <typename Type> void run_test(const std::string &env_ipath, const std::
480499
filename = vpIoTools::createFilePath(opath, "bin_with_img");
481500
vpIoTools::makeDirectory(filename);
482501
filename = vpIoTools::createFilePath(filename, "test_save_in_bin_with_img.bin");
502+
std::cout << "Save keypoints in binary with image in: " << filename << std::endl;
483503
keyPoints.saveLearningData(filename, true, true);
484504

485505
// Test if save is ok
@@ -491,16 +511,19 @@ template <typename Type> void run_test(const std::string &env_ipath, const std::
491511

492512
// Test if read is ok
493513
vpKeyPoint read_keypoint1;
514+
std::cout << "Load keypoints from: " << filename << std::endl;
494515
read_keypoint1.loadLearningData(filename, true);
495516
std::vector<cv::KeyPoint> trainKeyPoints_read;
496517
read_keypoint1.getTrainKeyPoints(trainKeyPoints_read);
497518
cv::Mat trainDescriptors_read = read_keypoint1.getTrainDescriptors();
498519

520+
std::cout << "Compare keypoints" << std::endl;
499521
if (!compareKeyPoints(trainKeyPoints, trainKeyPoints_read)) {
500522
throw vpException(vpException::fatalError, "Problem with trainKeyPoints when reading learning file saved in "
501523
"binary with train images saved !");
502524
}
503525

526+
std::cout << "Compare descriptors" << std::endl;
504527
if (!compareDescriptors(trainDescriptors, trainDescriptors_read)) {
505528
throw vpException(vpException::fatalError, "Problem with trainDescriptors when reading "
506529
"learning file saved in "
@@ -511,6 +534,7 @@ template <typename Type> void run_test(const std::string &env_ipath, const std::
511534
filename = vpIoTools::createFilePath(opath, "bin_without_img");
512535
vpIoTools::makeDirectory(filename);
513536
filename = vpIoTools::createFilePath(filename, "test_save_in_bin_without_img.bin");
537+
std::cout << "Save keypoints in binary without image in: " << filename << std::endl;
514538
keyPoints.saveLearningData(filename, true, false);
515539

516540
// Test if save is ok
@@ -522,23 +546,26 @@ template <typename Type> void run_test(const std::string &env_ipath, const std::
522546

523547
// Test if read is ok
524548
vpKeyPoint read_keypoint2;
549+
std::cout << "Load keypoints from: " << filename << std::endl;
525550
read_keypoint2.loadLearningData(filename, true);
526551
trainKeyPoints_read.clear();
527552
read_keypoint2.getTrainKeyPoints(trainKeyPoints_read);
528553
trainDescriptors_read = read_keypoint2.getTrainDescriptors();
529554

555+
std::cout << "Compare keypoints" << std::endl;
530556
if (!compareKeyPoints(trainKeyPoints, trainKeyPoints_read)) {
531557
throw vpException(vpException::fatalError, "Problem with trainKeyPoints when reading learning file saved in "
532558
"binary without train images saved !");
533559
}
534560

561+
std::cout << "Compare descriptors" << std::endl;
535562
if (!compareDescriptors(trainDescriptors, trainDescriptors_read)) {
536563
throw vpException(vpException::fatalError, "Problem with trainDescriptors when reading "
537564
"learning file saved in "
538565
"binary without train images saved !");
539566
}
540567

541-
#if defined(VISP_HAVE_PUGYXML)
568+
#if defined(VISP_HAVE_PUGIXML)
542569
// Save in xml with training images
543570
filename = vpIoTools::createFilePath(opath, "xml_with_img");
544571
vpIoTools::makeDirectory(filename);
@@ -607,37 +634,41 @@ template <typename Type> void run_test(const std::string &env_ipath, const std::
607634
vpKeyPoint keypoint_reset;
608635

609636
keypointName = "ORB";
637+
std::cout << "Use " << keypointName << " as keypoints" << std::endl;
610638
keypoint_reset.setDetector(keypointName);
611639
keypoint_reset.setExtractor(keypointName);
612640

613641
keypoint_reset.buildReference(I);
642+
std::cout << keypointName << " keypoints are detected" << std::endl;
614643

615644
// reset
616645
keypoint_reset.reset();
617646

618647
keypointName = "SIFT";
648+
std::cout << "Use " << keypointName << " as keypoints" << std::endl;
619649
keypoint_reset.setDetector(keypointName);
620650
keypoint_reset.setExtractor(keypointName);
621651

622652
keypoint_reset.buildReference(I);
653+
std::cout << keypointName << " keypoints are detected" << std::endl;
623654

624655
std::vector<cv::KeyPoint> trainKeyPoints_reset;
625656
keypoint_reset.getTrainKeyPoints(trainKeyPoints_reset);
657+
std::cout << "Get descriptors" << std::endl;
626658
cv::Mat trainDescriptors_reset = keypoint_reset.getTrainDescriptors();
627659

628-
// If reset is ok, we should get the same keypoints and the same
629-
// descriptors
660+
// If reset is ok, we should get the same keypoints and the same descriptors
661+
std::cout << "Compare keypoints" << std::endl;
630662
if (!compareKeyPoints(trainKeyPoints, trainKeyPoints_reset)) {
631663
throw vpException(vpException::fatalError, "Problem with vpKeyPoint::reset() and trainKeyPoints !");
632664
}
633665

666+
std::cout << "Compare descriptors" << std::endl;
634667
if (!compareDescriptors(trainDescriptors, trainDescriptors_reset)) {
635668
throw vpException(vpException::fatalError, "Problem with vpKeyPoint::reset() and trainDescriptors !");
636669
}
637670

638-
std::cout << "vpKeyPoint::reset() is ok with trainKeyPoints and "
639-
"trainDescriptors !"
640-
<< std::endl;
671+
std::cout << "vpKeyPoint::reset() is ok with trainKeyPoints and trainDescriptors !" << std::endl;
641672
#endif // OpenCV != 4.5.4 on macOS
642673
}
643674
#endif

0 commit comments

Comments
 (0)