How to use own features, computed in openCV, in vi

2019-07-08 22:53发布

问题:

I try to do a 3D reconstruction from multiple images. I am currently using the visual SFM Pipeline that takes in Lowe SIFT features as .feat and .mat format. Both are binary so I could not read them with editor. Due to the documentation of visual sfm:

Use your own feature matches 1. Write a txt file that contains all the feature matches 2. Load your images (with features) into VisualSFM 3. Use "SfM->Pairwise Matching->Import Feature Matches" 4. You may add feature matches by using the same method again.

*. This assumes that you already have detected the features. *. The same function for command line is option "+import" *. Do NOT use "SfM->Pairwise Matching->Compute Missing Match", which does full matching

The match file is in the following format Match file = Image-Match = <# of matches>

For example, the following gives the 24 matches between 888.jpg and 709.jpg

**888.jpg 709.jpg 24

19 18 24 3651 1511 2899 71 115 201 202 199 1639 2595 210 189 1355 268 241 137 728 1899 193 192 325
139 143 181 261 342 349 373 433 622 623 686 700 745 812 868 951 987 990 1001 1016 1021 1046 1047 1069

where feature #19 of 888.jpg matches feature #139 of 709.jpg**

I use the sift algorithm of openCV so I get for each image a matrix that has dimentions #Features x 128 and I save them as .sift for each image.

Afterwards I use the matching algorithm from openCV and get a file that has lines like that:

Image__2018-04-24__15-06-04.jpg Image__2018-04-24__15-06-11.jpg 955

22, 27, 33, 49, 59, 65, 72, 92, 97, 100, 101, 105, 106, 112, 116, 120, 123, 126, 127, 129, 137, 141, 142, 143, 144, 147, 152, 159, 160, 169, 179, 186, 188, 207, 223, 233, 250, 261, 265, 266, 268, 269, 292, 296, 297, 299, 300, 302, 304, 306, 308, 309, 312, 315, 318, 326, 327, 328, 329, 331, 333, 334, 337, 342, 348, 350, 358, 361, 364, 365, 369, 376, 380, 382, 383, 385, 386, 396, 403, 404, 407, 408, 410, 411, 417, 424, 427, 428, 429, 431, 432, 434, 435, 437, 438, 441, 443, 445, 446, 449, 450, 451, 452, 455, 458, 464, 465, 467, 468, 470, 471, 474, 477, 478, 480, 481, 482, 486, 488, 489, 490, 493, 494, 495, 496, 499, 501, 504, 505, 506, 509, 510, 511, 512, 514, 515, 516, 524, 526, 527, 528, 529, 530, 531, 533, 536, 538, 539, 541, 547, 549, 550, 554, 556, 560, 561, 563, 565, 567, 573, 574, 575, 577, 581, 582, 585, 587, 589, 590, 591, 596, 599, 602, 605, 610, 615, 616, 617, 618, 629, 630, 631, 633, 659, 665, 670, 671, 678, 680, 681, 682, 683, 686, 690, 692, 694, 698, 703, 706, 709, 710, 721, 723, 735, 736, 737, 739, 740, 742, 743, 744, 745, 746, 747, 748, 750, 751, 752, 753, 754, 756, 757, 759, 760, 761, 762, 763, 765, 767, 768, 769, 770, 771, 772, 773, 774, 775, 777, 787, 788, 789, 791, 792, 793, 794, 796, 800, 801, 803, 804, 805, 806, 809, 810, 811, 812, 814, 815, 817, 818, 819, 820, 821, 822, 825, 828, 829, 831, 834, 835, 836, 838, 839, 840, 841, 843, 844, 846, 847, 848, 851, 853, 854, 857, 858, 861, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 874, 875, 876, 877, 878, 879, 882, 883, 885, 886, 888, 889, 890, 894, 895, 897, 898, 901, 902, 905, 907, 909, 910, 912, 913, 914, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 930, 931, 932, 933, 934, 935, 936, 937, 938, 941, 942, 943, 947, 948, 949, 950, 953, 954, 957, 958, 959, 960, 961, 964, 965, 968, 969, 970, 971, 972, 973, 974, 976, 977, 978, 979, 980, 981, 982, 983, 985, 987, 988, 989, 990, 991, 992, 994, 995, 997, 1001, 1002, 1003, 1004, 1005, 1007, 1008, 1009, 1010, 1012, 1013, 1014, 1015, 1018, 1019, 1020, 1021, 1022, 1023, 1025, 1026, 1027, 1028, 1029, 1031, 1033, 1034, 1038, 1040, 1041, 1042, 1044, 1046, 1047, 1048, 1050, 1053, 1055, 1056, 1058, 1060, 1062, 1065, 1066, 1067, 1068, 1070, 1072, 1074, 1075, 1076, 1077, 1078, 1079, 1081, 1082, 1083, 1086, 1087, 1088, 1089, 1090, 1092, 1094, 1095, 1096, 1097, 1099, 1100, 1102, 1103, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1122, 1123, 1124, 1125, 1126, 1133, 1134, 1135, 1136, 1137, 1139, 1141, 1142, 1143, 1144, 1145, 1159, 1161, 1165, 1167, 1168, 1169, 1170, 1173, 1175, 1176, 1178, 1179, 1180, 1183, 1185, 1186, 1187, 1189, 1190, 1192, 1197, 1199, 1200, 1202, 1203, 1205, 1206, 1207, 1209, 1210, 1211, 1214, 1215, 1217, 1218, 1222, 1223, 1224, 1225, 1227, 1228, 1229, 1232, 1234, 1235, 1238, 1239, 1240, 1242, 1243, 1244, 1249, 1250, 1251, 1252, 1253, 1257, 1261, 1262, 1263, 1266, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1277, 1278, 1280, 1281, 1283, 1284, 1285, 1286, 1288, 1289, 1291, 1292, 1293, 1294, 1295, 1296, 1298, 1300, 1301, 1302, 1303, 1304, 1307, 1308, 1309, 1311, 1312, 1314, 1315, 1317, 1318, 1319, 1320, 1321, 1323, 1327, 1328, 1329, 1331, 1332, 1334, 1335, 1336, 1337, 1338, 1339, 1341, 1343, 1344, 1345, 1346, 1347, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1360, 1361, 1362, 1363, 1366, 1368, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1396, 1399, 1401, 1402, 1403, 1404, 1406, 1407, 1408, 1409, 1411, 1412, 1414, 1415, 1416, 1417, 1418, 1420, 1421, 1423, 1425, 1426, 1428, 1429, 1430, 1431, 1433, 1436, 1437, 1438, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1449, 1450, 1452, 1453, 1454, 1456, 1457, 1460, 1462, 1464, 1465, 1467, 1470, 1471, 1472, 1473, 1474, 1475, 1478, 1480, 1481, 1483, 1484, 1485, 1488, 1490, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1506, 1508, 1509, 1510, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1523, 1524, 1525, 1526, 1527, 1528, 1531, 1532, 1534, 1537, 1539, 1540, 1541, 1542, 1543, 1545, 1547, 1548, 1549, 1551, 1552, 1553, 1554, 1555, 1557, 1558, 1560, 1561, 1563, 1565, 1566, 1567, 1568, 1569, 1570, 1572, 1573, 1575, 1576, 1577, 1578, 1579, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1590, 1591, 1593, 1594, 1597, 1598, 1599, 1600, 1601, 1603, 1604, 1605, 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1616, 1618, 1619, 1620, 1622, 1623, 1625, 1627, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1641, 1643, 1644, 1648, 1649, 1650, 1652, 1653, 1655, 1656, 1657, 1658, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1669, 1670, 1671, 1672, 1673, 1674, 1675, 1677, 1678, 1679, 1682, 1683, 1684, 1685, 1686, 1689, 1690, 1692, 1696, 1697, 1699, 1700, 1702, 1705, 1708, 1710, 1711, 1712, 1713, 1714, 1715, 1717, 1718, 1719, 1720, 1723, 1726, 1727, 1730, 1731, 1732, 1734, 1735, 1736, 1737, 1739, 1740, 1741, 1742, 1744, 1745, 1747, 1748, 1749, 1750, 1752, 1753, 1754, 1755, 1756, 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, 1771, 1773, 1775, 1776, 1778, 1780, 1782, 1784, 1785, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1801, 1802, 1803, 1806, 1807, 1811, 1814, 1815, 1816, 1819, 1820, 1821, 1822, 1823, 1824, 1825, 1826, 1827, 1828, 1830, 1831, 1834, 1835, 1836

So I used the sfm -import function and inserted the matches.txt and the folder with images and .sift files. However I get only an empty n view match file (.nvm)

Does anybody what is wrong with this pipeline? and has anybody a hint how I get this working? In my opinion something is wrong with my format but I can not see what might be wrong

Thanks for the help

Best

Max