Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task02 Софья Копейкина СПБГУ #14

Closed
wants to merge 3 commits into from

Conversation

Nikrolaks
Copy link

@Nikrolaks Nikrolaks commented May 1, 2024

Черт возьми, я замаялась с 3 домашкой и, закончив ее наконец, заметила, что забыла отправить 2ую! Еще и запуталась в своем сэндбоксе, потому что давно к ней не возвращалась.. В общем, исправляюсь:

Перечислите идеи и коротко обозначьте мысли которые у вас возникали по мере выполнения задания, в частности попробуйте ответить на вопросы:

  1. Зачем фильтровать матчи, если потом мы запускаем устойчивый к выбросам RANSAC и отфильтровываем шумные сопоставления?

Фильтрация дешевле RANSAC и, т.к. точек после нее меньше, то выше вероятность выбрать их более качественно (даже несколько раз можно запустить, а если не фильтровать, то будет работать долго, туго и некачественно). В общем, я смотрю на это как на что-то такое: сначала все непонятно, полная мешанина, делается жесткий строгий жест в виде фильтрации, который помогает RANSAC уже хорошо реагировать, ему все видно и понятно.

  1. Cluster filtering довольно хорошо работает и без Ratio test. Однако, если оставить только Cluster filtering, некоторые тесты начнут падать. Почему так происходит? В каких случаях наоборот, не хватает Ratio test и необходима дополнительная фильтрация?

Ну вообще он упал только на одном тесте, но там вообще чет ничего не осталось после фильтрации. Судя по всему, он без ratio test слишком много отфильтровывает, чувствительный к выбросам. А Ratio test как раз эти выбросы убирает.

  1. С какой проблемой можно столкнуться при приравнивании единице элемента H33 матрицы гомографии? Как ее решить?

Кажется, иногда он может быть нулевым и тогда так делать некорректно.

  1. Какой подвох таится в попытке склеивать большие панорамы и ортофото методом, реализованным в данной домашке? (Для интуиции можно посмотреть на результат склейки, когда за корень взята какая-нибудь другая картинка)

Вообще мы же нормально относимся к неточностям, когда они маленькие или их мало, а тут неточности стакаются, так что видимо качество будет не очень хорошим

  1. Как можно автоматически построить граф для построения панорамы, чтобы на вход метод принимал только список картинок?

Вроде это уже обсуждалось на лекциях, мы находим остовное дерево наибольшего веса ребер, ну а в качестве корня можно выбрать вершину, балансирующую глубину

  1. Если есть, фидбек по заданию: какая часть больше всего понравилась, где-то слишком сложно/просто (что именно), где-то слишком мало ссылок и тд.

Я когда дебажила, у меня порой выскакивали какие-то дебаг-ассерты из библиотек: причем из кода заготовки. В общем-то, наверное не стоит писать не безопасный код - устройство памяти у классов может быть не совсем очевидным и такие трюки не сработают~~~

Travis CI

Run ./build/test_matching
Running main() from /home/runner/work/PhotogrammetryTasks2024/PhotogrammetryTasks2024/libs/3rdparty/libgtest/googletest/src/gtest_main.cc
[==========] Running 20 tests from 2 test suites.
[----------] Global test environment set-up.
[----------] 18 tests from MATCHING
[ RUN      ] MATCHING.SimpleStitching
testing sift detector/descriptor...
estimateHomographyRANSAC : support: 1005/1005
estimateHomographyRANSAC : best support: 1005/1005
keypoints RMSE: 0.11[6](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:7)314, color RMSE: 5.6938
[       OK ] MATCHING.SimpleStitching (696 ms)
[ RUN      ] MATCHING.SimpleMatching
testing sift detector/descriptor...
flann matching...
cv flann matching...
brute force matching
BruteforceMatcher::knnMatch : n query desc : 3919, n train desc : 3522
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 1005/1005
estimateHomographyRANSAC : best support: 1005/1005
evaluating homography...
nn_score: 0.610615, nn2_score: 0.26[7](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:8)16, nn_score_cv: 0.613167, nn2_score_cv: 0.266139, time_my: 0.069[8](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:9)48, time_cv: 0.068843, time_bruteforce: 4.39335, good_nn: 0.260015, good_ratio: 0.[9](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:10)70392, good_clusters: 0.996587, good_ratio_and_clusters: 0.999005
[       OK ] MATCHING.SimpleMatching (4864 ms)
[ RUN      ] MATCHING.Rotate[10](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:11)
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 755/758
estimateHomographyRANSAC : support: 757/758
estimateHomographyRANSAC : best support: 757/758
evaluating homography...
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.086991, time_cv: 0.08868, time_bruteforce: 0, good_nn: 0.18372, good_ratio: 0.883459, good_clusters: 0.925414, good_ratio_and_clusters: 0.919525
[       OK ] MATCHING.Rotate10 (680 ms)
[ RUN      ] MATCHING.Rotate20
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 766/766
estimateHomographyRANSAC : best support: 766/766
evaluating homography...
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.086554, time_cv: 0.087296, time_bruteforce: 0, good_nn: 0.201582, good_ratio: 0.941748, good_clusters: 0.967254, good_ratio_and_clusters: 0.994778
[       OK ] MATCHING.Rotate20 (637 ms)
[ RUN      ] MATCHING.Rotate30
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 750/751
gauss: infinitely many solutions found
gauss: xs0: 692.983, 732.073, 722.874, 692.983, 
gauss: ys0: 622.843, 198.509, 375.495, 622.843, 
estimateHomographyRANSAC : best support: 750/751
evaluating homography...
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.087664, time_cv: 0.088701, time_bruteforce: 0, good_nn: 0.182445, good_ratio: 0.880202, good_clusters: 0.913649, good_ratio_and_clusters: 0.921438
[       OK ] MATCHING.Rotate30 (674 ms)
[ RUN      ] MATCHING.Rotate40
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 754/754
estimateHomographyRANSAC : best support: 754/754
evaluating homography...
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.088837, time_cv: 0.089078, time_bruteforce: 0, good_nn: 0.196224, good_ratio: 0.949495, good_clusters: 0.9729, good_ratio_and_clusters: 0.984085
[       OK ] MATCHING.Rotate40 (642 ms)
[ RUN      ] MATCHING.Rotate45
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 685/765
estimateHomographyRANSAC : support: 764/765
estimateHomographyRANSAC : best support: 764/765
evaluating homography...
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.087723, time_cv: 0.088333, time_bruteforce: 0, good_nn: 0.200561, good_ratio: 0.957764, good_clusters: 0.988372, good_ratio_and_clusters: 0.996078
[       OK ] MATCHING.Rotate45 (675 ms)
[ RUN      ] MATCHING.Rotate90
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 631/831
estimateHomographyRANSAC : support: 759/831
estimateHomographyRANSAC : support: 830/831
estimateHomographyRANSAC : best support: 830/831
evaluating homography...
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.078208, time_cv: 0.080263, time_bruteforce: 0, good_nn: 0.217147, good_ratio: 0.964368, good_clusters: 0.988662, good_ratio_and_clusters: 0.99639
[       OK ] MATCHING.Rotate90 (653 ms)
[ RUN      ] MATCHING.Scale50
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 137/165
estimateHomographyRANSAC : support: 159/165
estimateHomographyRANSAC : support: 164/165
gauss: infinitely many solutions found
gauss: xs0: 587.709, 588.803, 749.701, 749.701, 
gauss: ys0: 483.456, 495.729, 412.857, 412.857, 
estimateHomographyRANSAC : support: 165/165
estimateHomographyRANSAC : best support: 165/165
evaluating homography...
too few matches: 0
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.046052, time_cv: 0.045496, time_bruteforce: 0, good_nn: 0.0441439, good_ratio: 0.787736, good_clusters: 0, good_ratio_and_clusters: 0.987879
[       OK ] MATCHING.Scale50 (350 ms)
[ RUN      ] MATCHING.Scale70
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 375/376
estimateHomographyRANSAC : support: 376/376
estimateHomographyRANSAC : best support: 376/376
evaluating homography...
too few matches: 28
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.057035, time_cv: 0.056[11](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:12)5, time_bruteforce: 0, good_nn: 0.0969635, good_ratio: 0.869359, good_clusters: 0, good_ratio_and_clusters: 0.962766
[       OK ] MATCHING.Scale70 (431 ms)
[ RUN      ] MATCHING.Scale90
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 657/657
estimateHomographyRANSAC : best support: 657/657
evaluating homography...
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.07[12](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:13)6, time_cv: 0.071624, time_bruteforce: 0, good_nn: 0.169686, good_ratio: 0.941945, good_clusters: 0.987854, good_ratio_and_clusters: 0.9802[13](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:14)
[       OK ] MATCHING.Scale90 (567 ms)
[ RUN      ] MATCHING.Scale110
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 789/789
estimateHomographyRANSAC : best support: 789/789
evaluating homography...
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.095302, time_cv: 0.094528, time_bruteforce: 0, good_nn: 0.202858, good_ratio: 0.930205, good_clusters: 0.9570[14](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:15), good_ratio_and_clusters: 0.970849
[       OK ] MATCHING.Scale110 (709 ms)
[ RUN      ] MATCHING.Scale130
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 836/838
estimateHomographyRANSAC : support: 837/838
estimateHomographyRANSAC : best support: 837/838
evaluating homography...
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.130782, time_cv: 0.130039, time_bruteforce: 0, good_nn: 0.218423, good_ratio: 0.95[15](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:16)22, good_clusters: 0.991952, good_ratio_and_clusters: 0.990453
[       OK ] MATCHING.Scale130 (949 ms)
[ RUN      ] MATCHING.Scale150
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 655/790
estimateHomographyRANSAC : support: 676/790
estimateHomographyRANSAC : support: 787/790
estimateHomographyRANSAC : support: 788/790
estimateHomographyRANSAC : support: 789/790
estimateHomographyRANSAC : best support: 789/790
evaluating homography...
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.181766, time_cv: 0.177848, time_bruteforce: 0, good_nn: 0.195968, good_ratio: 0.899[16](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:17), good_clusters: 0.927813, good_ratio_and_clusters: 0.936709
[       OK ] MATCHING.Scale150 (1194 ms)
[ RUN      ] MATCHING.Scale[17](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:18)5
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 4[18](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:19)/769
estimateHomographyRANSAC : support: 754/769
estimateHomographyRANSAC : support: 767/769
gauss: infinitely many solutions found
gauss: xs0: 722.329, 757.175, 593.969, 722.329, 
gauss: ys0: 580.209, 354.07, 423.467, 580.209, 
estimateHomographyRANSAC : best support: 767/769
evaluating homography...
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.239852, time_cv: 0.252902, time_bruteforce: 0, good_nn: 0.189844, good_ratio: 0.89532, good_clusters: 0.934924, good_ratio_and_clusters: 0.936281
[       OK ] MATCHING.Scale175 (1606 ms)
[ RUN      ] MATCHING.Scale200
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 852/856
estimateHomographyRANSAC : support: 854/856
estimateHomographyRANSAC : best support: 854/856
evaluating homography...
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.260013, time_cv: 0.255949, time_bruteforce: 0, good_nn: 0.217913, good_ratio: 0.944072, good_clusters: 0.968692, good_ratio_and_clusters: 0.975467
[       OK ] MATCHING.Scale200 (1790 ms)
[ RUN      ] MATCHING.Rotate10Scale90
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 506/649
estimateHomographyRANSAC : support: 507/649
estimateHomographyRANSAC : support: 536/649
estimateHomographyRANSAC : support: 636/649
estimateHomographyRANSAC : support: 644/649
estimateHomographyRANSAC : support: 649/649
estimateHomographyRANSAC : best support: 649/649
evaluating homography...
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.077788, time_cv: 0.078865, time_bruteforce: 0, good_nn: 0.155907, good_ratio: 0.86087, good_clusters: 0.913223, good_ratio_and_clusters: 0.904468
[       OK ] MATCHING.Rotate10Scale90 (599 ms)
[ RUN      ] MATCHING.Rotate30Scale75
testing sift detector/descriptor...
flann matching...
cv flann matching...
filtering matches by ratio test...
filtering matches by clusters...
filtering matches by ratio & clusters
estimating homography...
estimateHomographyRANSAC : support: 128/440
estimateHomographyRANSAC : support: 437/440
estimateHomographyRANSAC : support: 438/440
estimateHomographyRANSAC : best support: 438/440
evaluating homography...
nn_score: 0, nn2_score: 0, nn_score_cv: 0, nn2_score_cv: 0, time_my: 0.065762, time_cv: 0.065772, time_bruteforce: 0, good_nn: 0.113549, good_ratio: 0.912206, good_clusters: 0.917647, good_ratio_and_clusters: 0.963636
[       OK ] MATCHING.Rotate30Scale75 (489 ms)
[----------] 18 tests from MATCHING (18205 ms total)
[----------] 2 tests from STITCHING
[ RUN      ] STITCHING.SimplePanorama
estimateHomographyRANSAC : support: 998/1002
estimateHomographyRANSAC : support: 999/1002
estimateHomographyRANSAC : best support: 999/1002
bbox: [1272.23, 641.37], [0, -3.50796]
[       OK ] STITCHING.SimplePanorama (1247 ms)
[ RUN      ] STITCHING.Orthophoto
estimateHomographyRANSAC : support: 57/1442
estimateHomographyRANSAC : support: 68/1442
estimateHomographyRANSAC : support: 236/1442
estimateHomographyRANSAC : support: 450/1442
estimateHomographyRANSAC : best support: 450/1442
estimateHomographyRANSAC : support: 26/1133
estimateHomographyRANSAC : support: 264/1133
estimateHomographyRANSAC : support: 351/1133
estimateHomographyRANSAC : support: 363/1133
estimateHomographyRANSAC : support: 446/1133
estimateHomographyRANSAC : best support: 446/1133
estimateHomographyRANSAC : support: 220/2[19](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:20)2
estimateHomographyRANSAC : support: 223/2192
estimateHomographyRANSAC : support: 3[20](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:21)/2192
estimateHomographyRANSAC : support: 327/[21](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:22)92
estimateHomographyRANSAC : support: 346/2192
estimateHomographyRANSAC : support: 410/2192
estimateHomographyRANSAC : support: 442/2192
estimateHomographyRANSAC : support: 509/2192
estimateHomographyRANSAC : support: 769/2192
estimateHomographyRANSAC : best support: 769/2192
estimateHomographyRANSAC : support: 11/1317
estimateHomographyRANSAC : support: 415/1317
estimateHomographyRANSAC : support: 500/1317
estimateHomographyRANSAC : support: 513/1317
estimateHomographyRANSAC : best support: 513/1317
bbox: [1283.3, 1727.88], [-207.957, -360.519]
estimateHomographyRANSAC : support: 64/1195
estimateHomographyRANSAC : support: 95/1195
estimateHomographyRANSAC : support: 260/1195
estimateHomographyRANSAC : support: 279/1195
estimateHomographyRANSAC : support: 443/1195
estimateHomographyRANSAC : best support: 443/1195
estimateHomographyRANSAC : support: 281/1479
estimateHomographyRANSAC : support: 368/1479
estimateHomographyRANSAC : support: 592/1479
estimateHomographyRANSAC : support: 597/1479
estimateHomographyRANSAC : support: 636/1479
estimateHomographyRANSAC : best support: 636/1479
estimateHomographyRANSAC : support: 171/[22](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:23)10
estimateHomographyRANSAC : support: 251/2210
estimateHomographyRANSAC : support: 377/2210
estimateHomographyRANSAC : support: 719/2210
estimateHomographyRANSAC : best support: 719/2210
estimateHomographyRANSAC : support: 250/1311
estimateHomographyRANSAC : support: 498/1311
estimateHomographyRANSAC : support: 580/1311
estimateHomographyRANSAC : best support: 580/1311
bbox: [1[23](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:24)9.76, 864], [-173.897, -895.46]
n stable ortho kpts: : 20496
[       OK ] STITCHING.Orthophoto (227[25](https://github.com/Nikrolaks/PhotogrammetryTasks2024/actions/runs/8908424151/job/24464019817#step:8:26) ms)
[----------] 2 tests from STITCHING (23972 ms total)
[----------] Global test environment tear-down
[==========] 20 tests from 2 test suites ran. (42177 ms total)
[  PASSED  ] 20 tests.

@simiyutin
Copy link

Судя по всему, он без ratio test слишком много отфильтровывает, чувствительный к выбросам. А Ratio test как раз эти выбросы убирает.

Да, просто когда есть очень много шума, то повышается вероятность что он окажется и среди ближайших соседей и помешает кластеру перейти согласованно

@simiyutin
Copy link

Все хорошо, задача зачтена, 8/10 баллов 👍

@simiyutin simiyutin closed this May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants