├── .gitignore ├── Makefile ├── README.md ├── img1.haraff ├── img1.ppm ├── include ├── Common.h ├── MyDescriptors.h └── Utils.h ├── pca_miop.txt ├── src ├── Main.cpp ├── MyDescriptors.cpp └── Utils.cpp └── test.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .cproject 2 | .project 3 | *.liop* 4 | *.miop* 5 | *.oiop* 6 | *.o 7 | IntensityOrderFeature 8 | 9 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CC=g++ 2 | CXXFLAGS=-O3 `pkg-config --cflags opencv` -Iinclude 3 | LDFLAGS=`pkg-config --libs opencv` 4 | 5 | 6 | .PHONY: all clean 7 | IntensityOrderFeature: src/Main.cpp MyDescriptors.o Utils.o 8 | $(CC) $(CXXFLAGS) -o $@ MyDescriptors.o Utils.o src/Main.cpp $(LDFLAGS) 9 | 10 | MyDescriptors.o: include/Common.h Utils.o include/MyDescriptors.h src/MyDescriptors.cpp 11 | $(CC) $(CXXFLAGS) -c src/MyDescriptors.cpp -o $@ 12 | 13 | Utils.o: include/Common.h include/Utils.h src/Utils.cpp 14 | $(CC) $(CXXFLAGS) -c src/Utils.cpp -o $@ 15 | 16 | all: IntensityOrderFeature 17 | 18 | clean: 19 | rm -f *.o IntensityOrderFeature 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Intensity Order based Local Features 2 | 3 | 4 | IntensityOrderFeature is open source with a [public repository](https://github.com/foelin/IntensityOrderFeature.git) on GitHub. It includes the **LIOP**, **OIOP** and **MIOP** descriptors that are published in [1,2]. 5 | 6 | 7 | This is a free software. 8 | You can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | You should have received a copy of the GNU General Public License 13 | along with this software. If not, see . 14 | 15 | 16 | 17 | ### Usage 18 | Command line arguments: 19 | 20 | -img the input image file 21 | -kp the input region file 22 | -des the output descriptor file 23 | -type [liop] liop/oiop/miop/miop_fast 24 | -initSigma [0.0] Gaussian sigma for pre-smoothing 25 | -nSigma [1.2] Gaussian sigma for smoothing after normalization 26 | -srNum [1] the number of support regions 27 | -lsRadius [6] the local sampling radius of each pixel 28 | -normPatchWidth [41] the size of the normalized patch 29 | -liopType [1] weight type of LIOP, 1 for uniform weighing used in PAMI paper, 2 for weighting used in ICCV paper 30 | -liopRegionNum [6] the number of ordinal bins in LIOP 31 | -liopNum [4] the number of local sampling points around each pixel in LIOP 32 | -oiopType [1] the quantization strategy of OIOP, 1 for learning based quantization, 2 for standard quantization 33 | -oiopRegionNum [4] the number of ordinal bins in OIOP 34 | -oiopNum [3] the number of local sampling points around each pixel in OIOP 35 | -oiopQuantLevel [4] the number of quantization levels in OIOP 36 | -pcaFile the PCA parameters for MIOP 37 | -pcaBasisNum [128] the expected dimension after PCA in MIOP 38 | -isApplyPCA [0] applying PCA dimension reduction or not 39 | 40 | ### Version 41 | 1.0 42 | 43 | ### Requirement 44 | OpenCV 3.0+ 45 | 46 | ### Reference: 47 | [1] Zhenhua Wang, Bin Fan and Fuchao Wu, “Local Intensity Order Pattern for Feature Description", 48 | IEEE International Conference on Computer Vision (ICCV) , Nov. 2011 49 | 50 | [2] Zhenhua Wang, Bin Fan, Gang Wang and Fuchao Wu, “Exploring Local and Overall Ordinal Information for Robust Feature Description", 51 | IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 2016. 52 | 53 | 54 | -------------------------------------------------------------------------------- /img1.haraff: -------------------------------------------------------------------------------- 1 | 1.0 2 | 878 3 | 323.07 8.47 0.0558871 3.13436e-05 0.100113 4 | 853.05 175.45 0.0490674 0.0361507 0.126105 5 | 845.79 176.66 0.0464043 0.00299808 0.123488 6 | 785.29 191.18 0.125108 -0.0625447 0.0739421 7 | 854.26 192.39 0.0828606 -0.00565095 0.0690733 8 | 825.22 214.17 0.202415 0.022829 0.0266523 9 | 596.53 215.38 0.111536 -0.0192788 0.0522427 10 | 762.3 280.72 0.0758157 -0.0120231 0.0751168 11 | 603.79 297.66 0.224706 -0.0315812 0.0298245 12 | 586.85 331.54 0.0424294 0.0196173 0.122028 13 | 429.55 332.75 0.0616961 0.0205016 0.0918619 14 | 360.58 338.8 0.10348 0.0153153 0.0532632 15 | 331.54 349.69 0.064693 -0.0132043 0.0890261 16 | 742.94 373.89 0.0859456 0.0128889 0.058006 17 | 475.53 381.15 0.240841 -0.00767674 0.0231835 18 | 342.43 384.78 0.0493879 -0.0156048 0.113507 19 | 619.52 394.46 0.119201 0.00271886 0.0473338 20 | 659.45 394.46 0.0899055 -0.060305 0.0997959 21 | 462.22 399.3 0.071699 -0.015721 0.0700838 22 | 108.9 412.61 0.101865 0.0129123 0.053605 23 | 422.29 413.82 0.0932879 0.0384884 0.0752553 24 | 134.31 421.08 0.0836236 0.00389107 0.0676449 25 | 307.34 423.5 0.202308 -0.0670067 0.0495945 26 | 813.12 424.71 0.0845561 0.0116968 0.0649845 27 | 306.13 447.7 0.0446642 -0.0256587 0.13624 28 | 401.72 450.12 0.0449474 0.0426961 0.156389 29 | 116.16 517.88 0.0948377 -0.0503243 0.0848427 30 | 834.9 531.19 0.0746285 -0.0275283 0.0864352 31 | 406.56 534.82 0.0758324 0.0019641 0.0751039 32 | 107.69 537.24 0.116605 -0.00309836 0.0477826 33 | 108.9 542.08 0.110702 -0.0133692 0.0521187 34 | 894.19 548.13 0.0796056 0.0284166 0.0780343 35 | 315.447 11.979 0.0575095 0.0339473 0.0858084 36 | 167.706 19.965 0.0172223 0.00659848 0.2235 37 | 925.045 49.247 0.129127 -0.00760962 0.0279782 38 | 224.939 81.191 0.0360937 0.0137707 0.109154 39 | 814.572 182.347 0.0840047 0.00258489 0.045875 40 | 717.409 186.34 0.102547 0.016044 0.0396669 41 | 854.502 192.995 0.0685547 -0.00612903 0.0573343 42 | 870.474 207.636 0.1597 -0.0468168 0.0379735 43 | 855.833 210.298 0.214714 -0.0488028 0.0278359 44 | 355.377 282.172 0.0630939 -0.00512939 0.0530145 45 | 425.92 283.503 0.078184 -0.0644113 0.100611 46 | 433.906 288.827 0.0626904 -0.0330829 0.0697521 47 | 602.943 288.827 0.208836 -0.00220745 0.0169685 48 | 501.787 300.806 0.065121 0.0171291 0.0585313 49 | 327.426 302.137 0.0911189 0.0258909 0.0496773 50 | 763.994 312.785 0.19081 -0.00307667 0.0170743 51 | 437.899 331.419 0.0435816 -0.00699919 0.0783233 52 | 429.913 332.75 0.0453896 0.0160041 0.0827914 53 | 433.906 332.75 0.118045 -0.0105679 0.0306764 54 | 404.624 335.412 0.0660449 -0.0134634 0.0544772 55 | 463.188 338.074 0.0326034 -0.0168377 0.119598 56 | 338.074 340.736 0.0446539 -0.00750589 0.0829826 57 | 433.906 340.736 0.198547 -0.026347 0.0221932 58 | 311.454 343.398 0.0695016 -0.00434633 0.0558216 59 | 331.419 350.053 0.0564792 -0.0100495 0.0688336 60 | 777.304 360.701 0.104234 0.0184853 0.0373891 61 | 650.859 364.694 0.0418834 -0.000491705 0.0926799 62 | 962.313 372.68 0.0479622 0.0171785 0.0810459 63 | 463.188 380.666 0.0328964 -0.0064262 0.103506 64 | 312.785 385.99 0.0791767 -0.0257932 0.0563995 65 | 658.845 389.983 0.0662073 -0.0346403 0.0762476 66 | 891.77 399.3 0.0747795 0.0292644 0.0599817 67 | 415.272 401.962 0.113158 -0.060037 0.0664441 68 | 431.244 401.962 0.0843882 0.0270012 0.0540594 69 | 465.85 403.293 0.105272 -0.0485069 0.054722 70 | 839.861 408.617 0.0395923 -0.00767282 0.0999263 71 | 883.784 419.265 0.0901827 -0.045531 0.06601 72 | 304.799 420.596 0.167907 -0.0500341 0.0365261 73 | 794.607 423.258 0.0841774 -0.0105967 0.0433006 74 | 821.227 433.906 0.08353 -0.0346038 0.0554751 75 | 477.829 437.899 0.130278 -0.0303285 0.0326766 76 | 979.616 437.899 0.01524 -0.0185214 0.242679 77 | 937.024 447.216 0.0496408 0.0249691 0.0845931 78 | 235.587 448.547 0.0265684 -0.000188516 0.136578 79 | 224.939 449.878 0.0401675 0.0128586 0.101239 80 | 400.631 449.878 0.0456758 0.041948 0.123028 81 | 403.293 464.519 0.0347832 0.010518 0.110041 82 | 447.216 471.174 0.0571514 0.0226528 0.0667039 83 | 833.206 473.836 0.0390525 -0.0121865 0.0967924 84 | 323.433 477.829 0.0294145 0.00482308 0.131564 85 | 417.934 477.829 0.0429917 0.0195231 0.0980911 86 | 117.128 517.759 0.072672 -0.0415397 0.0729005 87 | 13.31 523.083 0.110255 0.00851728 0.0350803 88 | 404.624 524.414 0.104606 -0.00851534 0.0329275 89 | 326.095 527.076 0.036679 -0.00414907 0.0928973 90 | 640.211 528.407 0.0706752 -0.00251563 0.0462637 91 | 109.142 543.048 0.0740031 -0.00509603 0.0482167 92 | 886.446 548.372 0.0395621 -0.0226036 0.108526 93 | 976.954 578.985 0.0383206 0.0126783 0.0956072 94 | 376.31 372.68 0.0417174 -0.000752134 0.0628468 95 | 108.9 422.29 0.0584665 0.00545943 0.0434597 96 | 411.4 491.26 0.0659527 0.0295147 0.0477523 97 | 585.64 254.221 0.0519203 -0.00417938 0.0503532 98 | 437.899 376.673 0.201829 -0.0249878 0.0146493 99 | 865.15 389.983 0.0452413 -0.010451 0.0611906 100 | 456.533 468.512 0.045355 0.00302472 0.0537869 101 | 865.15 481.822 0.049512 -0.0357031 0.0725449 102 | 383.328 541.717 0.0611065 0.0033061 0.0427716 103 | 983.609 585.64 0.040345 0.00267546 0.056714 104 | 511.104 590.964 0.0863482 0.0325371 0.0429093 105 | 980.947 612.26 0.0633885 0.00156362 0.041351 106 | 314.782 11.7128 0.0437746 0.0299126 0.080929 107 | 212.295 64.4204 0.0471966 0.0241266 0.0616076 108 | 578.32 101.023 0.0421513 -0.00224359 0.0556639 109 | 874.068 183.013 0.0334051 -0.022339 0.0884834 110 | 762.796 190.333 0.0300343 0.0180078 0.0910452 111 | 755.476 191.797 0.0512584 -0.002445 0.0503572 112 | 855.034 193.261 0.0509144 -0.00750087 0.0490199 113 | 825.752 213.759 0.153075 0.0205372 0.0197598 114 | 603.209 289.892 0.205299 0.00105286 0.0128324 115 | 603.209 297.212 0.250675 -0.0302494 0.0139045 116 | 730.586 316.246 0.202454 -0.046699 0.0239237 117 | 661.773 325.03 0.0319455 -0.00204969 0.0776217 118 | 428.981 332.351 0.0386787 0.0140151 0.073839 119 | 587.104 332.351 0.0335672 0.00238421 0.0791153 120 | 780.365 336.743 0.0720189 0.00367791 0.0352894 121 | 360.169 338.207 0.0792231 0.0058045 0.0290537 122 | 464.12 338.207 0.0327459 -0.0153595 0.0887808 123 | 361.633 342.599 0.0549766 0.00121856 0.0454331 124 | 330.887 349.92 0.0357157 -0.00538249 0.0725123 125 | 339.671 349.92 0.0484339 0.0104867 0.057512 126 | 310.389 351.384 0.0771425 0.0120444 0.0340639 127 | 645.668 366.025 0.0405606 -0.0130217 0.0692426 128 | 364.561 383.594 0.0532336 0.0232217 0.0601511 129 | 376.274 386.522 0.0569413 0.00246437 0.0432847 130 | 652.989 386.522 0.0564412 -0.0267178 0.0556348 131 | 619.314 395.307 0.101913 0.01443 0.0247552 132 | 660.309 395.307 0.0655761 -0.0546989 0.0858404 133 | 814.04 399.699 0.048866 -0.012097 0.0487936 134 | 882.852 399.699 0.0701276 0.0237114 0.0432922 135 | 891.637 399.699 0.0667426 0.0217243 0.0472184 136 | 606.137 401.163 0.0598757 0.0242282 0.0503567 137 | 840.393 408.484 0.0295941 -0.00151535 0.089264 138 | 305.997 424.589 0.163961 -0.0486308 0.0297356 139 | 272.323 428.981 0.111466 0.0862835 0.0908813 140 | 840.393 443.622 0.0135373 0.00462723 0.19376 141 | 108.343 449.479 0.0910421 0.014777 0.027972 142 | 224.007 449.479 0.0358955 0.0130416 0.0756238 143 | 401.163 449.479 0.0342545 0.0370918 0.113774 144 | 418.733 477.297 0.0349661 0.0123858 0.0764075 145 | 399.699 489.009 0.0333982 0.0292839 0.102316 146 | 98.0947 506.579 0.189784 0.0166381 0.0133635 147 | 117.128 518.291 0.0681798 -0.0338105 0.0551873 148 | 325.03 527.076 0.0302505 -0.00922186 0.0831847 149 | 407.02 534.397 0.0457565 -0.00310198 0.0589215 150 | 689.591 543.181 0.0940328 -0.0462874 0.04929 151 | 484.617 544.645 0.0458413 0.0200451 0.0627924 152 | 837.465 584.176 0.0252633 0.0163584 0.103336 153 | 338.207 339.818 0.0281414 -0.00305481 0.0814075 154 | 234.74 77.44 0.0347008 0.00848468 0.0460449 155 | 755.04 191.18 0.0340658 -0.00191294 0.0509527 156 | 438.02 331.54 0.0327428 -0.00590999 0.0546206 157 | 310.97 352.11 0.0551271 0.0125799 0.0360392 158 | 646.14 366.63 0.0350327 -0.0091431 0.0507965 159 | 834.9 406.56 0.0315035 -0.029055 0.0810962 160 | 895.4 421.08 0.0845155 -0.0302363 0.0321119 161 | 980.1 438.02 0.0101999 -0.00159099 0.160448 162 | 936.54 447.7 0.0339898 0.0151409 0.0552101 163 | 418.66 477.95 0.0308037 0.0150116 0.0639576 164 | 267.41 544.5 0.0547959 -0.0136027 0.035605 165 | 905.08 550.55 0.0356907 0.0032114 0.0475375 166 | 821.36 434.838 0.0627921 -0.0284735 0.0378319 167 | 299.555 14.4946 0.020703 0.00368073 0.074454 168 | 924.433 48.3153 0.0950111 -0.00846605 0.0187618 169 | 19.3261 146.556 0.0296265 0.0276697 0.085345 170 | 14.4946 148.167 0.0360648 0.0109877 0.0521753 171 | 718.288 186.819 0.0840339 0.0094708 0.0226597 172 | 869.675 207.756 0.0992911 -0.0296535 0.024514 173 | 756.94 230.303 0.0981157 -0.00796642 0.0166906 174 | 584.615 244.798 0.0487266 0.00914374 0.0354311 175 | 758.55 272.176 0.0673024 -0.00208591 0.0238882 176 | 552.405 293.113 0.0281873 -0.0109707 0.0692957 177 | 502.479 301.165 0.0427268 0.0110195 0.0406359 178 | 326.934 302.776 0.0700671 0.0363624 0.0445173 179 | 554.016 314.049 0.0360481 0.0130353 0.0519168 180 | 460.606 328.544 0.0357918 0.00169849 0.0448621 181 | 587.836 331.765 0.032264 0.00285332 0.057098 182 | 404.238 334.986 0.0841785 -0.014428 0.0235028 183 | 592.668 334.986 0.0622683 -0.0100238 0.0299852 184 | 430.006 341.428 0.019867 -0.00273255 0.0864606 185 | 439.669 341.428 0.0319145 0.00943176 0.056978 186 | 405.849 344.649 0.0662077 0.00630733 0.0268017 187 | 360.754 347.87 0.0726195 -0.0132488 0.0271841 188 | 339.818 349.481 0.0273204 0.0113868 0.0653004 189 | 310.828 352.702 0.0988569 0.0112706 0.0191217 190 | 376.859 373.638 0.0395918 -3.59144e-05 0.0450183 191 | 795.592 373.638 0.0210808 -0.00285754 0.078229 192 | 442.89 376.859 0.0326952 0.0037805 0.0500283 193 | 642.594 378.47 0.0243691 -0.0262925 0.0962298 194 | 363.975 383.301 0.0406897 0.0190015 0.0536599 195 | 446.111 383.301 0.029861 -0.0145309 0.064423 196 | 314.049 384.912 0.0460326 -0.0136828 0.0409098 197 | 376.859 386.522 0.0495004 0.00236669 0.0368497 198 | 652.257 386.522 0.0508981 -0.0292664 0.0492451 199 | 402.628 389.743 0.0588178 -0.0192951 0.0356987 200 | 829.413 389.743 0.00979053 -0.0125802 0.195613 201 | 660.309 394.575 0.0605734 -0.0498885 0.0706602 202 | 458.995 396.185 0.0458699 -0.036499 0.0681766 203 | 607.162 401.017 0.0536351 0.020791 0.0400857 204 | 413.901 402.628 0.0541422 -0.0203512 0.0358091 205 | 430.006 402.628 0.0641608 0.0205022 0.0331492 206 | 874.507 404.238 0.0153033 -0.00314219 0.11514 207 | 840.686 409.07 0.0232306 0.00180216 0.0762116 208 | 280.229 415.512 0.0405264 0.0243401 0.0572846 209 | 895.444 420.343 0.0884746 -0.0260177 0.0282887 210 | 127.23 423.564 0.0243848 -0.0125626 0.0759646 211 | 980.801 438.059 0.0139816 -0.0157524 0.145525 212 | 312.439 447.722 0.0386477 -0.00160146 0.0461505 213 | 937.317 447.722 0.0349745 0.0124518 0.056232 214 | 154.609 449.332 0.0414408 0.00685976 0.0423204 215 | 225.471 449.332 0.0253982 0.00900339 0.0655966 216 | 236.745 449.332 0.0204834 0.00152794 0.0843407 217 | 821.36 450.943 0.0562862 -0.000165414 0.0308952 218 | 845.518 452.553 0.0349937 0.0303862 0.073903 219 | 834.244 465.437 0.0429899 -0.021681 0.0499223 220 | 447.722 471.879 0.0360519 0.0134159 0.0488675 221 | 851.96 483.153 0.102817 -0.0389672 0.0307376 222 | 407.459 489.595 0.0619013 0.0184149 0.0311912 223 | 117.567 491.206 0.131122 0.0418197 0.0265647 224 | 410.68 491.206 0.0782616 0.0275525 0.0321409 225 | 879.339 497.648 0.0434506 -0.00937182 0.0435721 226 | 98.2411 505.7 0.163938 0.0141354 0.0118427 227 | 678.025 508.921 0.164055 -0.0521068 0.0261275 228 | 537.91 515.363 0.0528718 0.0351916 0.0569718 229 | 117.567 518.584 0.0566432 -0.025452 0.0420585 230 | 835.855 531.468 0.037022 -0.0288601 0.0648827 231 | 689.298 542.742 0.0903335 -0.0432475 0.0401469 232 | 893.833 547.573 0.0496352 0.0214076 0.045956 233 | 977.58 547.573 0.0374145 -0.0202023 0.0524621 234 | 793.982 550.794 0.116821 0.049449 0.0343548 235 | 90.1886 552.405 0.141736 0.037925 0.0222226 236 | 856.791 555.626 0.0362046 -0.00970852 0.0513617 237 | 365.586 560.458 0.0610474 -0.00483601 0.029339 238 | 887.391 560.458 0.0491333 0.00608528 0.033451 239 | 516.974 566.9 0.0468968 -0.018656 0.0442691 240 | 975.969 579.784 0.0268072 0.00824142 0.070942 241 | 950.201 591.057 0.0812867 -0.0209308 0.0258887 242 | 698.961 655.478 0.0357308 0.0111147 0.0511334 243 | 657.249 389.743 0.0566289 -0.0456577 0.063867 244 | 554.18 314.6 0.0311554 0.0115635 0.0420076 245 | 813.12 378.73 0.0450345 -0.0136335 0.0291404 246 | 462.22 381.15 0.0198144 -0.00292762 0.060849 247 | 650.98 381.15 0.0273866 -0.00334676 0.0414553 248 | 396.88 423.5 0.0360777 -4.18903e-05 0.0331658 249 | 228.69 474.32 0.0170784 0.0116796 0.0755621 250 | 221.43 521.51 0.0275648 -0.00109501 0.0447785 251 | 511.83 590.48 0.0615044 0.0205652 0.0261119 252 | 299.475 15.972 0.0124082 0.00978077 0.0977946 253 | 577.654 101.156 0.0316844 -0.00212585 0.0392084 254 | 15.972 151.734 0.0386851 0.00578267 0.0298922 255 | 757.339 272.855 0.0433024 -0.00239929 0.0255694 256 | 555.027 314.116 0.0382333 0.00921893 0.0308908 257 | 586.971 331.419 0.0228046 0.00872107 0.0575499 258 | 827.882 401.962 0.0209066 -0.0217244 0.0745075 259 | 372.68 476.498 0.0415987 0.00577748 0.0276214 260 | 240.911 481.822 0.0989546 0.0219688 0.0169541 261 | 982.278 503.118 0.0155716 0.00596549 0.0752499 262 | 657.381 354.312 0.0422463 0.00311561 0.0293675 263 | 497.794 477.297 0.0330423 -0.000324566 0.0354994 264 | 513.899 481.689 0.0286747 -0.00410718 0.0426342 265 | 334.986 341.428 0.0291131 1.86852e-06 0.0420558 266 | 961.475 372.028 0.0263785 0.00788003 0.0456552 267 | 67.6414 552.405 0.0607172 -0.00811056 0.0205991 268 | 924.755 49.6037 0.0775556 -0.00535891 0.0158336 269 | 232.075 58.4615 0.10579 0.0076086 0.0110249 270 | 212.587 63.7762 0.0377001 0.0158114 0.0382214 271 | 235.618 77.9487 0.0232966 0.0248475 0.0730154 272 | 19.4872 147.04 0.0253294 0.0221884 0.068383 273 | 14.1725 148.811 0.031906 0.00687591 0.0389213 274 | 853.892 177.156 0.0132418 0.0227087 0.122468 275 | 814.918 182.471 0.0188796 0.0278991 0.0976994 276 | 873.38 182.471 0.0174845 -0.0149316 0.0836885 277 | 855.664 193.1 0.0244253 -0.00976688 0.0551612 278 | 604.102 216.13 0.0222092 0.0186322 0.0691108 279 | 756.457 230.303 0.105038 -0.00779436 0.0122846 280 | 579.3 249.79 0.0236235 0.0115606 0.0586643 281 | 758.228 272.82 0.0697957 -0.004655 0.0159995 282 | 760 281.678 0.0722219 -0.00380243 0.0162579 283 | 967.272 290.536 0.0425851 0.0182347 0.0325922 284 | 554.499 313.566 0.0377338 0.00909234 0.0346677 285 | 428.718 331.282 0.0243049 0.00790399 0.0496464 286 | 405.688 334.825 0.0459352 -0.00661676 0.0272529 287 | 781.258 336.597 0.0460785 0.00126847 0.0249703 288 | 359.627 338.368 0.0697488 0.00104177 0.0173211 289 | 361.398 343.683 0.170213 -0.0211857 0.00973985 290 | 340.14 350.769 0.0302319 0.00648024 0.0421442 291 | 375.571 373.799 0.0386421 -0.000656888 0.0295635 292 | 742.284 373.799 0.0443542 0.00157439 0.0257682 293 | 363.17 382.657 0.0317346 0.0139991 0.0445002 294 | 446.433 382.657 0.0196228 -0.00424881 0.0628356 295 | 618.275 384.429 0.0526759 0.0209674 0.0305713 296 | 239.161 389.743 0.0220762 0.00291683 0.0511875 297 | 864.522 391.515 0.0249105 -0.00829479 0.0526344 298 | 660.792 395.058 0.055326 -0.0479151 0.0639936 299 | 605.874 400.373 0.044185 0.0134863 0.0307666 300 | 891.095 400.373 0.0486617 0.0121368 0.0286549 301 | 813.147 405.688 0.0234759 0.00119617 0.0452742 302 | 108.065 412.774 0.0536934 0.0166818 0.026408 303 | 434.032 414.545 0.0409311 0.0257353 0.0463013 304 | 527.925 414.545 0.0333856 0.00468319 0.0337054 305 | 108.065 423.403 0.0397245 0.00379408 0.0278731 306 | 127.552 425.175 0.0170337 -0.000767574 0.0710021 307 | 304.709 425.175 0.0972632 -0.023738 0.0182572 308 | 396.83 425.175 0.027141 0.00538488 0.0439354 309 | 846.806 453.52 0.0284699 0.0192615 0.0563943 310 | 820.233 464.149 0.035498 -0.0027854 0.0328294 311 | 138.182 465.921 0.0587898 0.00561772 0.0202592 312 | 221.445 465.921 0.0395325 -0.000738505 0.0286514 313 | 228.531 473.007 0.0139537 0.00506197 0.0890697 314 | 832.634 474.778 0.0247146 -0.0116309 0.0510729 315 | 372.028 476.55 0.0504393 0.0114366 0.0256687 316 | 239.161 481.865 0.0700253 0.0107644 0.0169049 317 | 230.303 506.666 0.0576621 0.0313474 0.0386472 318 | 279.907 515.524 0.0184296 0.011339 0.0706969 319 | 354.312 520.839 0.0479082 0.00526075 0.0256314 320 | 324.196 527.925 0.0180867 -0.00602 0.059776 321 | 641.305 527.925 0.0410676 -0.0117557 0.0293762 322 | 267.506 529.697 0.0246492 -0.0162993 0.0572204 323 | 873.38 535.011 0.0261742 -0.00610864 0.043277 324 | 108.065 538.555 0.045553 0.00713742 0.0256054 325 | 690.909 543.869 0.0472416 -0.0267555 0.0380924 326 | 837.948 582.844 0.0150175 0.00472096 0.0715803 327 | 279.907 586.387 0.0253887 -0.0156199 0.0551307 328 | 227.601 65.219 0.0664106 0.000546215 0.0112679 329 | 362.032 343.398 0.0262441 -0.000506856 0.0305886 330 | 846.25 178.62 0.0158782 0.00659946 0.0559256 331 | 759.868 281.107 0.0380216 -0.00105816 0.0197753 332 | 795.006 373.346 0.0142221 8.24705e-05 0.0591267 333 | 828.681 401.163 0.0189004 -0.0194007 0.0627903 334 | 298.676 408.484 0.0322228 -0.016602 0.030942 335 | 371.881 477.297 0.0446507 0.00903805 0.0186877 336 | 317.71 499.258 0.0311082 -0.01077 0.0267749 337 | 79.0614 506.579 0.0125326 -0.0105581 0.0708233 338 | 976.555 510.971 0.0233991 0.0105737 0.0402475 339 | 487.545 553.43 0.0165319 -0.00767597 0.0487257 340 | 887.245 559.286 0.034054 0.0055293 0.0234239 341 | 845.518 193.261 0.0172592 0.00319156 0.0471854 342 | 334.986 296.334 0.0499132 0.0302695 0.0350727 343 | 901.886 380.08 0.0462708 0.038322 0.0496499 344 | 407.459 481.543 0.0183988 0.0112443 0.0523339 345 | 88.5781 500.869 0.0190325 -0.0138973 0.0513542 346 | 591.701 331.282 0.0397783 -0.0026824 0.0185695 347 | 242.704 389.743 0.0206646 0.00144002 0.0379677 348 | 300.102 13.641 0.0157231 0.000967424 0.0455814 349 | 845.743 194.872 0.0195212 0.00380842 0.0384084 350 | 855.487 194.872 0.0228376 -0.0075226 0.0343418 351 | 859.384 241.641 0.0309539 0.00846899 0.0287181 352 | 584.615 255.282 0.0464304 -0.00575787 0.0178355 353 | 354.667 282.564 0.0297869 0.000553405 0.0285908 354 | 760 282.564 0.0929643 -0.00550319 0.00896071 355 | 434.564 290.359 0.0368457 -0.0316274 0.0501025 356 | 646.974 294.256 0.0333973 -0.00139194 0.0217617 357 | 553.436 313.743 0.0228636 0.00935143 0.0397481 358 | 459.897 329.333 0.0167454 0.00685053 0.048148 359 | 432.615 331.282 0.079275 -0.00481156 0.0107529 360 | 311.795 352.718 0.108826 0.0115653 0.00815826 361 | 625.538 366.359 0.0224701 0.0036394 0.038674 362 | 962.666 372.205 0.0213307 -0.000406563 0.0358069 363 | 376.102 374.154 0.0350517 -0.000827033 0.0226287 364 | 795.077 374.154 0.0174848 -0.00534752 0.0492086 365 | 643.077 378.051 0.018071 -0.0243087 0.0744211 366 | 313.743 385.846 0.0275939 -0.00956136 0.030698 367 | 420.923 385.846 0.0280812 -0.0120508 0.0305245 368 | 378.051 387.795 0.0361304 0.00170557 0.0221992 369 | 976.307 387.795 0.021438 -0.000968734 0.0347943 370 | 241.641 389.743 0.0216897 0.00113776 0.0370849 371 | 660.615 395.59 0.0503236 -0.0459954 0.0576442 372 | 426.769 397.538 0.0365985 -0.00960232 0.0243969 373 | 874.974 405.333 0.00733076 0.000515446 0.107667 374 | 814.564 407.282 0.0169858 0.0079919 0.0489487 375 | 834.051 407.282 0.0182 -0.0169678 0.0555214 376 | 841.846 407.282 0.0129285 -0.00128541 0.0633471 377 | 298.154 409.231 0.038473 -0.0171004 0.0268486 378 | 795.077 422.872 0.0372782 -0.00260738 0.0210987 379 | 126.667 424.82 0.0138595 -0.00411854 0.0606992 380 | 304 424.82 0.0769448 -0.0186981 0.0155627 381 | 311.795 446.256 0.0293066 -0.00354752 0.0267227 382 | 937.333 446.256 0.0229689 0.00750848 0.0361065 383 | 226.051 450.154 0.0230185 0.00562632 0.0373683 384 | 401.436 450.154 0.0146221 0.0175188 0.0770301 385 | 822.359 452.102 0.0358535 -0.004143 0.0239912 386 | 847.692 454.051 0.0223061 0.0116113 0.04181 387 | 403.384 465.743 0.0155269 0.0113515 0.0624088 388 | 456 469.641 0.0269219 0.00746736 0.0318957 389 | 208.513 471.59 0.0341363 -0.0151402 0.0304231 390 | 229.949 473.538 0.0121496 0.00686355 0.0700277 391 | 321.538 477.436 0.0120724 -0.00636203 0.0682475 392 | 424.82 489.128 0.0303749 0.00153219 0.026233 393 | 878.872 496.923 0.0300253 -0.0120267 0.0323111 394 | 97.4359 504.718 0.117033 0.0239237 0.0118703 395 | 358.564 508.615 0.0272795 -0.00121136 0.0296451 396 | 978.256 510.564 0.0196045 0.00779137 0.0441228 397 | 116.923 518.359 0.0395364 -0.00671741 0.0198096 398 | 313.743 522.256 0.0209928 -0.0183479 0.0540016 399 | 972.41 532 0.0542084 0.0127195 0.0178568 400 | 109.128 539.795 0.036026 0.00676793 0.0247098 401 | 635.282 541.743 0.0545916 0.019519 0.020861 402 | 265.026 543.692 0.0351186 -0.0081036 0.0248553 403 | 366.359 561.231 0.0386911 -0.00290165 0.0217648 404 | 362.461 588.513 0.0274105 -0.00637954 0.0308203 405 | 949.025 590.461 0.0734272 -0.0197981 0.0166592 406 | 300.141 14.641 0.0113585 0.00403043 0.0481947 407 | 849.178 245.969 0.0137424 0.00489285 0.0383446 408 | 153.731 449.479 0.0238934 0.00304106 0.0246466 409 | 207.902 471.44 0.0344597 -0.0142782 0.0224365 410 | 426.053 489.009 0.0300538 0.000935363 0.0170814 411 | 83.4537 547.573 0.0679172 0.00882099 0.00933946 412 | 233.524 57.9784 0.0519083 0.0106857 0.0128356 413 | 235.134 77.3045 0.0160112 0.0120761 0.0409408 414 | 829.413 401.017 0.0157631 -0.0179896 0.0567833 415 | 837.465 583.005 0.0107054 0.00357415 0.0496242 416 | 276.523 30.0102 0.0446421 -0.00494937 0.0133058 417 | 923.887 47.159 0.0616977 -0.00545877 0.00971365 418 | 932.461 68.5948 0.0656369 0.0210411 0.0153444 419 | 19.2923 145.764 0.0159126 0.0107947 0.0383896 420 | 872.441 158.626 0.0176973 -0.00197017 0.0289251 421 | 853.148 177.918 0.00747868 0.01745 0.116623 422 | 752.4 192.923 0.0283576 0.00227644 0.0179954 423 | 848.861 244.369 0.0142518 0.00153829 0.0345403 424 | 608.779 255.087 0.0300454 0.00790746 0.0201216 425 | 773.836 259.374 0.0397649 -0.00611762 0.0142439 426 | 400.851 276.523 0.0197184 -0.000547653 0.0290856 427 | 780.266 336.543 0.0393441 -0.00309446 0.014978 428 | 312.964 340.831 0.0657305 0.00523373 0.00929409 429 | 658.082 355.836 0.0220899 0.00512878 0.0266509 430 | 735.251 372.984 0.0406701 -0.00880542 0.0157177 431 | 810.277 377.272 0.020927 -0.0101644 0.0293503 432 | 364.41 381.559 0.0271425 0.00732611 0.0213571 433 | 402.995 387.99 0.0434993 -0.00633048 0.013863 434 | 426.574 398.708 0.0324991 -0.0074651 0.0181409 435 | 413.713 400.851 0.0416354 -0.0174875 0.0208281 436 | 891.733 400.851 0.0369897 0.00476198 0.016105 437 | 812.42 405.138 0.0187768 0.00497813 0.0318231 438 | 527.323 413.713 0.02346 0.00451723 0.0247987 439 | 833.856 426.574 0.0382026 0.0331297 0.0429221 440 | 891.733 448.01 0.0177899 -0.010246 0.0336532 441 | 154.338 450.154 0.0228481 0.00516307 0.0267422 442 | 402.995 450.154 0.0103998 0.0133474 0.0723788 443 | 846.718 454.441 0.019387 0.00856489 0.0331113 444 | 820.995 465.159 0.018984 -0.00201188 0.0299936 445 | 448.01 471.59 0.0194022 0.00871947 0.0295576 446 | 229.364 473.733 0.0109505 0.00516396 0.0548725 447 | 372.984 478.02 0.0357956 0.0107116 0.0194903 448 | 411.569 490.882 0.0393031 0.0129276 0.0172542 449 | 362.267 497.313 0.0705967 0.0304261 0.020578 450 | 79.3128 501.6 0.0120573 -0.0142201 0.0644149 451 | 289.385 520.892 0.0272461 0.00427543 0.0210765 452 | 323.682 527.323 0.013446 -0.00727985 0.0457537 453 | 265.805 544.472 0.0339023 -0.0078732 0.0182266 454 | 488.738 553.046 0.0131873 -0.00512125 0.045761 455 | 495.169 559.477 0.0144484 -0.00356222 0.0378345 456 | 988.195 559.477 0.0320026 -0.0127665 0.0228056 457 | 516.605 568.051 0.0244736 -0.0148289 0.0312566 458 | 775.979 583.056 0.0366274 -0.00142653 0.0146862 459 | 836 583.056 0.0100746 0.00455723 0.0577368 460 | 362.267 589.487 0.0207647 -0.00584925 0.0284123 461 | 827.64 212.215 0.0579753 0.0113386 0.0107232 462 | 756.94 248.019 0.0676181 -0.0101096 0.00723022 463 | 818.139 478.322 0.00652472 0.00219844 0.0612024 464 | 289.892 521.805 0.0309534 0.00535502 0.01374 465 | 314.049 523.416 0.0168639 -0.0129178 0.0316304 466 | 405.849 523.416 0.0318375 -0.000495075 0.0115792 467 | 880.949 533.079 0.0168442 0.00611589 0.0243452 468 | 965.501 343.683 0.00749812 0.00240646 0.0459219 469 | 783.03 356.084 0.027637 0.00942926 0.0167449 470 | 676.736 418.088 0.036602 0.00572436 0.0111894 471 | 829.091 432.261 0.0298242 -0.00803137 0.0155437 472 | 384.429 545.641 0.0195918 0.00373714 0.018824 473 | 212.215 63.6646 0.0215067 0.00852925 0.0207755 474 | 596.561 153.267 0.0114072 0.00581077 0.0327906 475 | 844.145 195.71 0.0143789 0.00578701 0.0283742 476 | 754.543 207.499 0.0571006 0.00239162 0.00653076 477 | 867.725 207.499 0.0392356 -0.0116296 0.013123 478 | 851.219 209.857 0.0755134 0.00083975 0.00498032 479 | 400.851 278.238 0.0217476 7.91181e-05 0.0181064 480 | 780.481 334.829 0.0351948 -0.00298107 0.0111553 481 | 966.759 344.26 0.00845089 0.00475258 0.0453603 482 | 631.93 377.272 0.00964516 -0.00173925 0.0350079 483 | 448.01 384.346 0.012672 -0.00609908 0.0334565 484 | 422.073 386.703 0.0218038 -0.00863823 0.0192206 485 | 976.19 386.703 0.0171527 -0.00371107 0.0221025 486 | 813.492 398.493 0.0179594 -5.48631e-05 0.0215812 487 | 412.641 400.851 0.0315331 -0.0111452 0.0156416 488 | 124.971 424.431 0.00944199 -0.00389356 0.0384973 489 | 669.657 431.504 0.0418276 0.01465 0.0142281 490 | 829.998 445.652 0.0169691 -0.00665411 0.0249264 491 | 155.625 448.01 0.0198968 0.00505845 0.0212157 492 | 403.209 466.874 0.011332 0.0086587 0.0406656 493 | 455.084 469.232 0.0188238 0.00681609 0.0229846 494 | 320.681 478.663 0.00737698 -0.00165355 0.0529918 495 | 372.556 478.663 0.0305298 0.00995672 0.0155717 496 | 261.732 481.021 0.02364 0.00728442 0.018494 497 | 424.431 490.453 0.0263001 0.00165095 0.0142913 498 | 80.1702 499.885 0.00898568 -0.00831662 0.0486151 499 | 318.323 499.885 0.0224136 -0.0106966 0.0222385 500 | 358.408 509.317 0.0269012 0.0053175 0.0151556 501 | 978.548 511.675 0.0150975 0.00359414 0.0270501 502 | 224.005 521.107 0.0168934 0.00500353 0.0247498 503 | 874.799 535.254 0.0176161 -0.00322065 0.0227209 504 | 261.732 537.612 0.0192111 -0.00623628 0.0225716 505 | 384.346 544.686 0.0177717 0.00377205 0.020905 506 | 509.317 551.76 0.0171105 -0.00476617 0.0243337 507 | 495.169 561.192 0.0143292 -0.00143022 0.0276069 508 | 363.124 589.487 0.0170566 -0.00393217 0.0221951 509 | 509.317 591.845 0.0283518 0.0131396 0.0197409 510 | 669.65 430.489 0.0295145 0.0138101 0.0147992 511 | 260.419 481.865 0.0170195 0.00342943 0.0152324 512 | 290.536 520.839 0.0217958 0.00421712 0.0118866 513 | 719.077 187.077 0.0437697 0.00316294 0.00585467 514 | 886.666 352.718 0.0469349 0.00833175 0.00671282 515 | 880.82 438.461 0.00724406 0.0111852 0.0544825 516 | 892.513 448.205 0.014567 -0.00786852 0.0225794 517 | 89.641 500.82 0.0126126 -0.00681076 0.025164 518 | 982.154 502.769 0.00873405 0.00220545 0.0289545 519 | 57.8769 553.046 0.0388972 -0.00759339 0.00735764 520 | 648.436 542.328 0.0301599 -0.0115214 0.0124512 521 | 277.53 28.5312 0.0217255 -0.00234135 0.0108172 522 | 931.154 67.4373 0.0327927 0.00943704 0.00989538 523 | 936.341 80.406 0.0275319 0.00959769 0.0116347 524 | 874.091 184.156 0.00862981 -0.00629089 0.0329739 525 | 752.185 191.937 0.0156041 0.00329017 0.0165458 526 | 848.154 243.812 0.0105676 -0.000515438 0.0255803 527 | 772.935 259.374 0.0297005 -0.00429022 0.00958375 528 | 402.03 277.53 0.0137594 -0.00110624 0.0189819 529 | 352.749 285.312 0.015803 0.00214426 0.0152641 530 | 459.092 326.812 0.0188459 -0.00328092 0.0145856 531 | 461.686 339.78 0.00927232 -0.00213318 0.026351 532 | 313.843 342.374 0.0529857 0.00543247 0.00530023 533 | 363.124 381.28 0.0169794 0.00425527 0.0157418 534 | 313.843 383.874 0.0223893 -0.00580696 0.0131481 535 | 829.998 399.436 0.00933919 -0.00969643 0.0353882 536 | 108.937 414.999 0.0145307 -0.000848809 0.016259 537 | 391.655 420.186 0.00879338 0.00910902 0.0399119 538 | 796.279 420.186 0.0178923 0.00531462 0.0165505 539 | 822.216 435.749 0.0189352 -0.00644951 0.0154291 540 | 228.249 472.061 0.0100801 0.00147199 0.025161 541 | 290.499 474.655 0.00743984 -0.00663946 0.0402466 542 | 261.968 479.842 0.020932 0.00679764 0.0151787 543 | 472.061 482.436 0.0217067 0.00754781 0.0138861 544 | 425.374 490.217 0.0265942 0.000185144 0.00966256 545 | 80.406 500.592 0.00848878 -0.00784437 0.0373733 546 | 316.437 500.592 0.0193431 -0.00872397 0.0179451 547 | 324.218 526.53 0.00911955 -0.0051665 0.0322944 548 | 77.8123 529.124 0.0335982 0.0093455 0.0106596 549 | 261.968 536.905 0.0176443 -0.0066029 0.0178191 550 | 264.562 544.686 0.0252894 -0.00684382 0.0117469 551 | 692.529 544.686 0.0213104 -0.0137886 0.0205852 552 | 67.4373 557.655 0.021125 -0.00897431 0.0154943 553 | 495.405 560.248 0.0115134 -0.00219916 0.0232917 554 | 518.749 578.405 0.00989709 -0.0049581 0.0283401 555 | 835.185 583.592 0.00699351 0.0040212 0.0383594 556 | 363.124 588.78 0.0162135 -0.00276699 0.0159789 557 | 796.279 635.467 0.0312052 -0.0309695 0.0394759 558 | 276.718 29.2308 0.0250816 -0.00249833 0.00702339 559 | 756.102 239.692 0.0500165 0.00154598 0.00332263 560 | 399.487 276.718 0.0138166 0.000674005 0.0117076 561 | 550.902 293.672 0.00642182 -0.00171602 0.0256217 562 | 336.543 349.405 0.0055393 0.00256352 0.0289273 563 | 456.584 448.01 0.00651809 -0.00826664 0.0359231 564 | 293.672 553.046 0.0112936 0.00449438 0.0160265 565 | 221.647 488.095 0.0294942 0.00405486 0.00683122 566 | 636.646 542.328 0.0215982 0.00545244 0.00961001 567 | 66.0225 556.476 0.0183202 -0.00570916 0.010285 568 | 261.732 570.623 0.0223244 -0.0146506 0.0172304 569 | 211.131 62.7686 0.0148071 0.00564924 0.0139591 570 | 824.551 182.6 0.00557272 0.0131592 0.0641498 571 | 873.054 185.453 0.00703565 -0.00507966 0.0283228 572 | 607.714 216.837 0.00799355 0.00296305 0.0229936 573 | 242.515 222.543 0.0178786 0.00211928 0.0101045 574 | 505.002 319.549 0.0129841 -0.00336818 0.0148854 575 | 781.754 333.815 0.0257445 -0.00354857 0.0074727 576 | 764.635 359.493 0.0472829 -0.00607091 0.00446167 577 | 430.821 376.611 0.0316627 -0.00142117 0.00593203 578 | 810.285 376.611 0.0107077 -0.00690208 0.0200564 579 | 422.261 385.171 0.0187774 -0.00546462 0.0111544 580 | 450.793 385.171 0.00808233 -0.00434811 0.0235254 581 | 975.766 385.171 0.0121769 -0.00398273 0.0143455 582 | 405.143 388.024 0.0364105 -0.0069704 0.00638433 583 | 388.024 419.408 0.00819051 0.0114062 0.0369217 584 | 796.02 422.261 0.0151555 0.00182191 0.0110438 585 | 285.312 445.086 0.00998287 0.00433961 0.0184683 586 | 821.698 453.646 0.0153666 0.000179886 0.0110009 587 | 453.646 470.764 0.0146101 0.00735297 0.015747 588 | 319.549 479.324 0.00470723 -0.00146493 0.0396764 589 | 373.758 479.324 0.0199063 0.0105674 0.014711 590 | 482.177 482.177 0.0280961 0.0122476 0.0114527 591 | 222.543 505.002 0.0236111 0.0029869 0.00743458 592 | 265.34 544.945 0.0202766 -0.00625443 0.00982449 593 | 522.12 547.799 0.014739 0.00173324 0.0126582 594 | 97.006 553.505 0.0338598 0.00714373 0.00650134 595 | 507.855 553.505 0.0107284 -0.00555906 0.0201794 596 | 493.589 562.064 0.00989239 -0.00171758 0.0171059 597 | 519.267 579.183 0.00867361 -0.00341547 0.022039 598 | 796.02 636.245 0.0225129 -0.0221705 0.0296329 599 | 505.287 316.981 0.0127113 -0.00224278 0.0128151 600 | 100.749 450.154 0.0122543 0.000698566 0.00886375 601 | 210.072 484.451 0.0140386 -0.00505386 0.010207 602 | 220.79 488.738 0.0225499 0.00224302 0.00566316 603 | 90.0307 499.456 0.00845973 -0.00346083 0.0148935 604 | 874.584 533.754 0.0108186 -0.00326095 0.0118685 605 | 66.4513 557.333 0.0153088 -0.00562169 0.00948072 606 | 806.418 445.652 0.0212415 0.0160267 0.0176626 607 | 830.257 191.159 0.00656992 0.00791201 0.028452 608 | 875.907 533.533 0.0145454 -0.00425906 0.00926314 609 | 972.913 533.533 0.0174085 0.00327903 0.00702205 610 | 507.855 593.448 0.0147506 0.0082861 0.0124092 611 | 279.32 28.2459 0.0114774 -0.00109382 0.00979065 612 | 872.483 166.337 0.00706814 0.00656676 0.0236232 613 | 772.054 191.444 0.00518106 0.000240127 0.023 614 | 831.684 191.444 0.00785399 0.00773588 0.0235204 615 | 750.085 194.583 0.0146334 0.0013756 0.00779862 616 | 244.797 222.828 0.0133327 0.0016387 0.00970777 617 | 844.237 244.797 0.00706354 -0.00295151 0.0161605 618 | 401.719 279.32 0.012703 -0.000325272 0.00986343 619 | 429.965 335.812 0.00428665 0.00292613 0.0309798 620 | 966.636 345.227 0.0067654 0.0025335 0.0176344 621 | 429.965 376.611 0.0188205 -0.000138642 0.00628212 622 | 448.795 382.888 0.00556767 -0.00108833 0.0226321 623 | 298.151 411.134 0.0240819 -0.0102452 0.00934311 624 | 401.719 411.134 0.00838073 0.00456553 0.0167815 625 | 122.399 423.688 0.0075034 -0.0011109 0.0161289 626 | 881.898 423.688 0.0112258 0.00521664 0.0134755 627 | 881.898 439.38 0.00514349 0.00391625 0.0259029 628 | 100.43 448.795 0.0138638 0.000880046 0.0080478 629 | 979.19 461.349 0.0179995 0.00586189 0.00891592 630 | 404.857 467.626 0.00621241 0.00319354 0.0202069 631 | 291.874 473.903 0.00454965 -0.0046338 0.0299021 632 | 834.822 480.18 0.0157066 -0.0103372 0.014476 633 | 404.857 492.733 0.0292824 0.00522093 0.00520348 634 | 97.2913 499.01 0.0389671 0.0135503 0.00784572 635 | 316.981 502.149 0.0116406 -0.00545494 0.0117868 636 | 291.874 514.702 0.00586678 -0.000613123 0.0190918 637 | 407.996 520.979 0.0227764 0.00217441 0.00569196 638 | 263.628 536.671 0.0138447 -0.0058187 0.0108313 639 | 97.2913 552.363 0.035345 0.00770349 0.00504934 640 | 65.907 555.502 0.0154736 -0.00502892 0.00947813 641 | 888.175 558.64 0.012399 0.00143453 0.00989534 642 | 263.628 574.333 0.0149479 -0.0104588 0.0150349 643 | 950.944 590.025 0.0261264 -0.00234687 0.00485669 644 | 276.182 31.0704 0.011031 -0.000505022 0.0103785 645 | 735.68 372.556 0.0180648 -0.0035326 0.00543256 646 | 721.06 186.749 0.0375649 0.000194684 0.00225516 647 | 407.218 490.217 0.0246494 0.00552772 0.0047052 648 | 738.957 373.758 0.0180595 -0.00205163 0.00429517 649 | 169.161 27.6182 0.00918986 -0.000734748 0.00935112 650 | 214.041 62.1409 0.0112123 0.00327225 0.0077042 651 | 876.877 231.302 0.0332939 0.00211078 0.00253804 652 | 352.132 286.539 0.0101442 0.00121887 0.00863711 653 | 548.911 296.895 0.00534538 -0.000339739 0.0156993 654 | 504.032 303.8 0.00820763 0.0018017 0.0102553 655 | 807.832 376.298 0.00716314 -0.00471307 0.014819 656 | 314.157 383.202 0.0126055 -0.0028685 0.006536 657 | 410.82 400.464 0.0181193 -0.00243107 0.00487916 658 | 521.293 421.177 0.0100507 0.0025917 0.009195 659 | 797.475 421.177 0.0110507 0.00374397 0.00863962 660 | 155.352 448.795 0.0093821 0.00474924 0.0102694 661 | 890.686 448.795 0.00875155 -0.000954499 0.00848879 662 | 980.445 462.604 0.0147477 0.00395454 0.00655802 663 | 452.248 469.509 0.011187 0.00606782 0.010456 664 | 831.998 490.223 0.00980265 -0.00880264 0.0156801 665 | 96.6636 497.127 0.0262221 0.00926361 0.00656983 666 | 462.604 538.554 0.00993344 -2.94592e-05 0.00792114 667 | 566.173 545.459 0.00750456 0.000369715 0.0104716 668 | 352.132 573.077 0.0102875 -0.000362583 0.00823568 669 | 490.223 583.434 0.00502116 -0.00192898 0.0178494 670 | 614.717 215.281 0.00362093 0.000994196 0.0164599 671 | 452.248 383.202 0.00334477 -0.000330981 0.0157253 672 | 421.177 493.675 0.0137242 0.00154992 0.00416728 673 | 876.877 531.65 0.013859 -0.00372224 0.00498907 674 | 941.78 79.7475 0.0179766 0.00553468 0.00484334 675 | 869.627 163.292 0.00383368 0.0030102 0.0160254 676 | 839.247 197.47 0.00879784 0.00339808 0.00784868 677 | 592.41 205.065 0.0120908 0.00276671 0.00491698 678 | 862.032 235.445 0.00787541 0.00296827 0.00827889 679 | 843.045 243.04 0.00598862 -0.00266816 0.0102065 680 | 402.535 281.015 0.00956433 -0.000392084 0.00594156 681 | 550.637 311.395 0.00568631 0.00227695 0.0110276 682 | 622.79 364.56 0.00579039 -0.000671973 0.00909207 683 | 296.205 410.13 0.0193103 -0.00925899 0.00748069 684 | 387.345 417.725 0.00475236 0.0069612 0.0220738 685 | 675.955 417.725 0.0130286 0.000998227 0.00461844 686 | 881.02 425.32 0.00765265 0.00460652 0.0104706 687 | 98.735 448.105 0.010158 0.000870215 0.00587092 688 | 888.615 451.902 0.00963411 -0.000139316 0.0051842 689 | 318.99 527.852 0.00445091 -0.00145795 0.0122337 690 | 265.825 535.447 0.00998575 -0.00393893 0.00662383 691 | 68.355 554.435 0.00873838 -0.00276818 0.00673366 692 | 478.485 558.232 0.00527946 -0.000257905 0.00956906 693 | 265.825 577.22 0.00824122 -0.00613911 0.0116139 694 | 489.877 584.815 0.00383635 -0.00118585 0.0143947 695 | 793.677 637.98 0.0104424 -0.0109801 0.0170751 696 | 751.905 196.331 0.0105129 0.000808472 0.00535177 697 | 338.357 346.712 0.00999937 -0.000213835 0.00500915 698 | 522.12 422.261 0.0068978 0.00181699 0.00631735 699 | 487.883 456.499 0.0128193 0.00124405 0.00301339 700 | 596.302 153.783 0.00347965 0.00267108 0.0129562 701 | 630.824 376.611 0.00342854 -0.000826952 0.0111101 702 | 527.256 417.411 0.00691336 0.00165327 0.0060865 703 | 279.876 29.2407 0.00478792 -0.000112647 0.00843324 704 | 710.132 187.976 0.0297174 -0.00320223 0.00157599 705 | 593.169 208.862 0.0109953 0.00204042 0.00346713 706 | 246.458 221.394 0.0071899 0.00136778 0.00589221 707 | 350.889 288.23 0.00712714 0.000962495 0.00575315 708 | 547.22 296.585 0.00335739 -1.50725e-05 0.0107713 709 | 664.183 325.825 0.00663064 5.83791e-05 0.00559998 710 | 789.5 342.534 0.00976654 -0.00259006 0.00418858 711 | 739.373 371.775 0.0252094 -0.0021539 0.00172523 712 | 806.209 375.952 0.00494164 -0.00294445 0.00990048 713 | 630.765 380.13 0.00408883 -0.00144546 0.00992713 714 | 409.37 401.016 0.0131244 -0.000956036 0.00308672 715 | 296.585 413.548 0.0157135 -0.00681793 0.00549706 716 | 388.484 421.902 0.00438593 0.00684898 0.0193078 717 | 797.855 421.902 0.00894464 0.00364733 0.0055516 718 | 288.23 442.788 0.00624146 0.00053801 0.00623539 719 | 317.471 451.143 0.00397281 -5.79502e-05 0.0101349 720 | 643.296 534.688 0.00931517 -0.000996658 0.00385591 721 | 568.106 547.22 0.00481186 0.00176876 0.00869307 722 | 952.413 568.106 0.0166115 0.00169509 0.00235348 723 | 505.447 593.169 0.0055811 0.00357692 0.00864373 724 | 973.299 618.233 0.00813088 -0.000339447 0.00494684 725 | 947.806 59.6301 0.0135832 0.00287964 0.00257578 726 | 293.443 514.388 0.00294659 -0.000434648 0.00874372 727 | 964.565 375.952 0.00495386 -0.00214444 0.00644256 728 | 839.627 413.548 0.00324982 0.00193171 0.00845811 729 | 409.37 522.156 0.00913496 0.00100819 0.00270738 730 | 941.97 82.7095 0.0120834 0.00329135 0.00279576 731 | 868.45 165.419 0.0028798 0.00295204 0.0121283 732 | 707.626 188.394 0.0183437 -0.00210156 0.00148402 733 | 771.956 192.989 0.00282863 0.000181163 0.00960729 734 | 592.752 206.774 0.0121354 0.00203694 0.00249304 735 | 248.129 220.559 0.00588087 0.00120612 0.00489321 736 | 863.855 234.344 0.00492791 0.00143906 0.00546735 737 | 840.88 243.534 0.00477213 -0.00223943 0.00671831 738 | 404.358 280.293 0.00573229 -0.000549841 0.00438713 739 | 964.945 289.483 0.00696967 0.00225425 0.00443944 740 | 505.447 303.268 0.0034812 0.00130437 0.00774859 741 | 363.003 376.788 0.00950347 3.33565e-05 0.00289298 742 | 317.053 381.383 0.00741213 -0.00130265 0.00392901 743 | 450.307 385.978 0.00417103 -0.00215208 0.0077215 744 | 408.953 404.358 0.00845315 -1.2979e-05 0.00303493 745 | 298.673 413.548 0.0179165 -0.00828313 0.00533164 746 | 487.067 459.497 0.0111456 0.00205732 0.00286273 747 | 418.143 491.662 0.00966846 0.000611863 0.00284035 748 | 96.4945 496.257 0.0117358 0.00580313 0.00492112 749 | 321.648 500.852 0.00442872 -0.00126316 0.00576423 750 | 225.154 505.447 0.0084167 0.00192147 0.00366106 751 | 408.953 519.232 0.0102135 0.0010226 0.00274873 752 | 643.296 533.017 0.00754815 -0.000547769 0.00331153 753 | 271.103 537.612 0.00686138 -0.0022218 0.00417254 754 | 776.551 578.967 0.0121809 -0.000914962 0.00207357 755 | 505.447 597.347 0.00362906 0.00286087 0.00882772 756 | 479.866 483.318 0.00769224 0.00320602 0.00354696 757 | 269.277 542.007 0.00639064 -0.00262035 0.00365627 758 | 237.56 50.5447 0.00457282 0.00173929 0.00448301 759 | 945.186 60.6537 0.0101983 0.00216423 0.00215899 760 | 171.852 70.7626 0.00199308 0.00322636 0.0133356 761 | 707.626 187.015 0.0184707 -0.00252488 0.0013077 762 | 596.428 207.233 0.00657012 0.00137022 0.00303876 763 | 247.669 222.397 0.00497516 0.000689591 0.00372864 764 | 404.358 283.05 0.00633712 -0.000335957 0.00292866 765 | 662.136 323.486 0.00469389 -0.000134976 0.00392877 766 | 970.458 384.14 0.00400973 -0.00143861 0.0050172 767 | 323.486 449.848 0.00259197 0.000884355 0.00655213 768 | 485.229 459.957 0.0089556 0.00185335 0.00247325 769 | 111.198 480.175 0.0156635 0.00621541 0.00364372 770 | 419.521 495.338 0.0083454 0.00063143 0.00230652 771 | 227.451 505.447 0.00655666 0.00152259 0.00305694 772 | 970.458 505.447 0.00612047 0.00288069 0.00424509 773 | 571.155 545.883 0.00344977 0.00173104 0.0056727 774 | 955.295 566.101 0.00974163 0.000971639 0.00185785 775 | 783.949 344.715 0.0109155 -0.0024861 0.0021093 776 | 100.254 438.611 0.00478143 0.000681785 0.00245368 777 | 100.254 446.966 0.00475017 0.000687923 0.00263863 778 | 401.016 472.029 0.0023713 0.00143789 0.00606056 779 | 404.358 473.282 0.00256733 0.000598093 0.00490539 780 | 172.357 72.2789 0.00134951 0.00169689 0.0116102 781 | 839.548 244.636 0.00337293 -0.00154124 0.00440444 782 | 405.874 283.556 0.00537092 -0.000339051 0.00234281 783 | 967.426 289.116 0.00622465 0.00157994 0.00233866 784 | 316.915 378.074 0.00529211 -0.000759671 0.0023468 785 | 633.831 378.074 0.00258022 -0.00217082 0.00621723 786 | 839.548 433.674 0.00336982 0.0011621 0.00377004 787 | 483.713 461.473 0.006687 0.00152743 0.00202651 788 | 111.198 483.713 0.0117607 0.00469925 0.00288852 789 | 233.517 483.713 0.00667607 0.00122524 0.00207633 790 | 416.994 494.833 0.00681114 0.000256832 0.00185732 791 | 294.676 517.072 0.00250959 9.88044e-05 0.00483692 792 | 411.434 517.072 0.00689171 0.00053024 0.0018971 793 | 478.153 561.552 0.00224539 -0.00104393 0.00612614 794 | 778.389 578.232 0.00678716 -0.00103391 0.00180165 795 | 170.014 73.5196 0.00101484 0.0012447 0.00966905 796 | 174.609 220.559 0.00361523 -0.00057729 0.00247482 797 | 836.285 431.928 0.00302429 0.00157673 0.00345751 798 | 343.704 566.101 0.00173253 0.000487654 0.00481593 799 | 550.432 300.236 0.00202093 0.000234971 0.00438944 800 | 250.752 220.173 0.00386964 0.000393002 0.00214577 801 | 507.621 311.911 0.00170421 0.00016849 0.00512339 802 | 226.289 507.621 0.0037732 0.000872327 0.00239011 803 | 697.214 544.316 0.0046936 -0.00258847 0.00328391 804 | 103.97 550.432 0.00416102 0.000348291 0.0021103 805 | 342.491 568.78 0.00141635 0.000510583 0.00624527 806 | 788.953 642.171 0.00272483 -0.00308505 0.0066522 807 | 192.989 510.042 0.00219226 0.000539928 0.00263921 808 | 174.915 67.275 0.00140749 0.00209304 0.00732147 809 | 598.748 208.553 0.00621206 0.00073823 0.000921174 810 | 410.378 282.555 0.00306469 -0.000372344 0.00190338 811 | 356.558 376.74 0.00330946 3.29686e-05 0.00163403 812 | 403.65 403.65 0.0039628 0.000210663 0.00132121 813 | 484.38 464.198 0.00451923 0.00101098 0.001509 814 | 410.378 518.018 0.00400738 1.6298e-05 0.00128128 815 | 484.38 558.383 0.00139851 -0.00102874 0.00500936 816 | 955.305 565.11 0.0057212 0.000430252 0.000980751 817 | 370.013 518.018 0.00288054 0.000289848 0.00136839 818 | 407.014 288.61 0.00430743 -8.58116e-05 0.000917198 819 | 510.617 310.811 0.00111817 0.000123809 0.00367419 820 | 828.828 407.014 0.00197346 0.000631621 0.00202315 821 | 103.604 444.015 0.0032883 0.00137947 0.00167845 822 | 325.611 444.015 0.00145337 0.00045903 0.00276064 823 | 229.408 503.217 0.00255362 0.000534595 0.00156234 824 | 414.414 518.018 0.00333118 5.62246e-05 0.00112482 825 | 695.624 540.218 0.00385341 -0.00197484 0.00204816 826 | 170.946 65.1222 0.000916001 0.00119234 0.00446402 827 | 545.399 301.19 0.00110693 0.000146118 0.00224782 828 | 463.996 366.312 0.00188665 -0.000408368 0.0015365 829 | 618.661 366.312 0.0015284 -0.000858997 0.00205682 830 | 634.942 382.593 0.00143548 -0.00108919 0.00273234 831 | 455.856 390.733 0.0020292 -0.00068621 0.00161332 832 | 398.874 398.874 0.00326198 0.000197001 0.000797983 833 | 667.503 415.154 0.00246188 -0.000475749 0.00107475 834 | 325.611 447.715 0.00113478 0.00048808 0.00245708 835 | 480.276 463.996 0.00268255 0.000595372 0.0010287 836 | 879.15 463.996 0.00580431 0.000904674 0.000570482 837 | 577.96 537.258 0.00186156 0.000701757 0.00171413 838 | 358.172 374.453 0.00222938 3.10077e-05 0.000746901 839 | 698.436 537.258 0.00233689 -0.00109763 0.00128162 840 | 707.39 358.172 0.00369103 1.97392e-05 0.000342243 841 | 866.777 256.093 0.00169673 -0.000475381 0.00084592 842 | 413.689 295.492 0.00290464 -8.43345e-05 0.000444944 843 | 551.585 305.342 0.00100632 6.91573e-05 0.00128023 844 | 512.186 315.192 0.00068438 -6.38768e-05 0.00191001 845 | 827.378 403.839 0.00135011 0.000327557 0.000988655 846 | 876.627 462.938 0.00454454 0.000483517 0.000330916 847 | 492.487 561.435 0.000683481 -0.000520537 0.00209895 848 | 108.347 433.388 0.00208352 0.000274632 0.000463181 849 | 528.304 429.807 0.000813296 0.000499188 0.000976002 850 | 322.355 438.761 0.00061125 4.71979e-05 0.000943179 851 | 704.256 357.545 0.00176097 -0.000115982 0.000321327 852 | 870.027 262.2 0.0014837 -0.000345903 0.000485278 853 | 548.236 309.873 0.000778041 -3.79473e-06 0.000755517 854 | 500.564 560.155 0.000448225 -0.000325332 0.00158904 855 | 865.26 262.2 0.00120858 -0.000297332 0.00041005 856 | 406.41 301.53 0.00214413 0.000100774 0.000181908 857 | 655.5 406.41 0.000879326 -0.000324448 0.000585559 858 | 865.26 458.85 0.0012506 0.000121382 0.000210014 859 | 865.26 273.999 0.00105914 -0.000208984 0.000300706 860 | 357.545 476.727 0.000390797 0.000383068 0.000839468 861 | 317.262 432.63 0.000390799 -4.19727e-05 0.000497784 862 | 618.661 348.988 0.000533414 -0.000258939 0.000443525 863 | 650.387 412.441 0.000721906 -0.000282812 0.000379462 864 | 222.083 491.756 0.000355256 -2.56044e-05 0.000462979 865 | 491.756 523.482 0.000278778 7.69156e-05 0.000614793 866 | 872.47 279.191 0.000918275 -0.00013377 0.000210485 867 | 628.179 348.988 0.000492529 -0.000237445 0.000369675 868 | 331.539 436.235 0.000291575 2.84305e-05 0.000426516 869 | 680.527 558.381 0.000198587 -7.66734e-05 0.000611528 870 | 499.053 518.247 0.00017633 2.79425e-05 0.000489739 871 | 337.821 422.276 0.00026843 -3.86725e-05 0.000287196 872 | 865.26 374.946 0.000518624 7.23618e-05 0.000119585 873 | 317.262 428.304 0.000228883 -6.11832e-05 0.000251746 874 | 863.746 364.693 0.000463633 7.642e-05 0.000142831 875 | 627.079 325.152 0.000270674 -0.000104045 0.00018567 876 | 383.887 296.64 0.000394689 6.2141e-06 6.67847e-05 877 | 714.083 442.052 8.88455e-05 -2.4641e-05 0.000110654 878 | 306.572 255.477 0.000100162 -5.99446e-06 6.08748e-05 879 | 618.254 309.127 6.6275e-05 -2.27005e-05 5.20457e-05 880 | 362.074 362.074 4.39572e-05 -1.53692e-05 7.12765e-05 881 | -------------------------------------------------------------------------------- /img1.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foelin/IntensityOrderFeature/111e3e51150e032520dd3836035c667845eeb044/img1.ppm -------------------------------------------------------------------------------- /include/Common.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////// 2 | // 3 | // NAME 4 | // Common.h -- common definitions and functions. 5 | // 6 | // DESCRIPTION 7 | // This file includes some common used definitions and functions, and 8 | // some necessary header files for this project. 9 | // 10 | ////////////////////////////////////////////////////////////////////////// 11 | 12 | #define TEST_TIME 13 | 14 | #ifndef COMMON_H 15 | #define COMMON_H 16 | 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include "assert.h" 29 | #include "opencv2/opencv.hpp" 30 | 31 | 32 | using namespace std; 33 | using namespace cv; 34 | 35 | class AffineKeyPoint 36 | { 37 | public: 38 | 39 | AffineKeyPoint() : pt(0,0), a(1.f), b(0.f), c(1.f), angle(-1), response(0), octave(0), class_id(-1) {} 40 | 41 | AffineKeyPoint(Point2f _pt, float _a, float _b, float _c, float _size=1, float _angle=-1, 42 | float _response=0, int _octave=0, int _class_id=-1) 43 | : pt(_pt), a(_a), b(_b), c(_c), angle(_angle), 44 | response(_response), octave(_octave), class_id(_class_id){} 45 | 46 | AffineKeyPoint(float x, float y, float _a, float _b, float _c, float _angle=-1, 47 | float _response=0, int _octave=0, int _class_id=-1) 48 | : pt(x, y), a(_a), b(_b), c(_c), angle(_angle), 49 | response(_response), octave(_octave), class_id(_class_id) {} 50 | 51 | Point2f pt; //!< coordinates of the keypoints 52 | 53 | //parameters for the ellipse 54 | float a; 55 | float b; 56 | float c; 57 | 58 | 59 | float angle; //!< computed orientation of the keypoint (-1 if not applicable); 60 | //!< it's in [0,360) degrees and measured relative to 61 | //!< image coordinate system, ie in clockwise. 62 | float response; //!< the response by which the most strong keypoints have been selected. Can be used for the further sorting or subsampling 63 | int octave; //!< octave (pyramid layer) from which the keypoint has been extracted 64 | int class_id; //!< object class (if the keypoints need to be clustered by an object they belong to) 65 | 66 | 67 | 68 | }; 69 | 70 | 71 | typedef unsigned char uchar; 72 | enum DES_TYPE{ UNDEFINE, 73 | LIOP, 74 | OIOP, 75 | MIOP, 76 | MIOP_FAST 77 | }; 78 | 79 | //vgg affine x,y,a,b,c 80 | //lowe affine y,x,scal,orien,a,b,c 81 | enum DES_FORMAT{DES_INT,DES_FLOAT}; 82 | 83 | const float INFMIN_F = FLT_EPSILON; 84 | const double INFMIN_D = DBL_EPSILON; 85 | 86 | const double MAX_DIS = 1000000.0; 87 | 88 | 89 | template 90 | inline void Swap(T &v1, T &v2) 91 | { 92 | T temp = v1; 93 | v1 = v2; 94 | v2 = temp; 95 | } 96 | 97 | template 98 | inline T Max(T x, T y) 99 | { 100 | return (x > y) ? x : y; 101 | } 102 | 103 | template 104 | inline T Min(T x, T y) 105 | { 106 | return (x < y) ? x : y; 107 | } 108 | 109 | 110 | // Simple error handling 111 | inline void FatalError(const char *msg) 112 | { 113 | cerr << msg << endl; 114 | exit(1); 115 | } 116 | 117 | void GeneratePatternMap(std::map**pattern_map, int** pos_weight, int n); 118 | bool NextPermutation(int *p, int n); 119 | 120 | typedef struct _Params{ 121 | double initSigma; 122 | 123 | float mrScale; // the ratio between Measure Region and Detected Retion 124 | int normPatchWidth; // the size of the normalized patch, set to 41 as in the paper 125 | 126 | DES_FORMAT desFormat; // 127 | DES_TYPE des_type; // type of the descriptors, LIOP, OIOP, MIOP, MIOP_FAST 128 | 129 | int liopType; // weighting type of LIOP 130 | int liopRegionNum; // number of ordinal bins 131 | int liopNum; // number of sampling points around each pixel 132 | double liopThre; //threshold for weighting function used in ICCV paper 133 | map* pLiopPatternMap; // LIOP index tabel 134 | int * pLiopPosWeight; // weights for encoding LIOP to a decimal number 135 | 136 | 137 | int oiopType; // quantization strategy of OIOP 138 | int oiopRegionNum; // number of ordinal bins 139 | int oiopQuantLevel; // number of quantization level 140 | int oiopNum; // number of sampling points around each pixel 141 | 142 | int lsRadius; //local sample radius; 143 | double nSigma; //Gaussian sigma after normalization 144 | 145 | 146 | int srNum; //support region number 147 | float srScaleStep; //scale step between mr 148 | 149 | bool isAffine; // affine covariant region or not 150 | 151 | string PCAFile; // pca parameters for MIOP 152 | int PCABasisNum; // the dimension after dimension reduction 153 | int isApplyPCA; // apply pca on MIOP or not 154 | 155 | _Params() 156 | { 157 | this->initSigma = 0.0; 158 | this->mrScale = 3.0; 159 | this->normPatchWidth = 41; 160 | 161 | this->desFormat = DES_INT; 162 | 163 | this->oiopType = 1; 164 | this->oiopRegionNum = 4; 165 | this->oiopQuantLevel = 4; 166 | this->oiopNum = 3; 167 | 168 | this->liopType = 1; 169 | this->liopRegionNum = 6; 170 | this->liopNum = 4; 171 | this->pLiopPatternMap = NULL; 172 | this->pLiopPosWeight = NULL; 173 | GeneratePatternMap(&this->pLiopPatternMap, &this->pLiopPosWeight, this->liopNum); 174 | 175 | this->lsRadius = 6; 176 | this->nSigma = 1.2; 177 | this->liopThre = 5.0; 178 | this->des_type = LIOP; 179 | this->srNum = 1; 180 | this->srScaleStep = 1.5f; 181 | 182 | this->isAffine = true; 183 | 184 | this->PCAFile = "pca_miop.txt"; 185 | this->PCABasisNum = 128; 186 | this->isApplyPCA = 0; 187 | } 188 | 189 | ~_Params() 190 | { 191 | if (this->pLiopPatternMap!=NULL) 192 | { 193 | delete this->pLiopPatternMap; 194 | pLiopPatternMap = NULL; 195 | } 196 | if(this->pLiopPosWeight!=NULL) 197 | { 198 | delete [] this->pLiopPosWeight; 199 | pLiopPosWeight = NULL; 200 | } 201 | } 202 | 203 | }Params; 204 | 205 | typedef struct _Pixel{ 206 | float x; 207 | float y; 208 | float angle; //angle of this pixel relative to the center of the patch 209 | float f_gray; 210 | int i_gray; 211 | float weight; 212 | int o_pattern; //overall pattern 213 | int l_pattern; //local pattern 214 | int id; 215 | 216 | _Pixel() 217 | { 218 | x = 0.f; 219 | y = 0.f; 220 | angle = 0.f; 221 | f_gray = 0.f; 222 | i_gray = 0; 223 | weight = 0.f; 224 | o_pattern = 0; 225 | l_pattern = 0; 226 | id = 0; 227 | } 228 | 229 | 230 | inline _Pixel& operator=(const _Pixel& p) 231 | { 232 | this->x = p.x; 233 | this->y = p.y; 234 | this->angle = p.angle; 235 | this->f_gray = p.f_gray; 236 | this->i_gray = p.i_gray; 237 | this->o_pattern = p.o_pattern; 238 | this->l_pattern = p.l_pattern; 239 | this->id = p.id; 240 | this->weight = p.weight; 241 | return *this; 242 | } 243 | }Pixel; 244 | 245 | ////////////////////////////////////////////////////////// 246 | // Sture for Patch Dataset 247 | typedef struct _DIR_INFO{ 248 | string dir_name; 249 | int img_num; 250 | int last_img_patch_num; 251 | int patch_num; 252 | }DIR_INFO; 253 | 254 | typedef struct _MATCH_INFO 255 | { 256 | int m_patchId1; 257 | int m_3dPointId1; 258 | int m_patchId2; 259 | int m_3dPointId2; 260 | bool isCorrect; 261 | }MATCH_INFO; 262 | 263 | 264 | 265 | const int IMG_LENGTH = 1024; 266 | const int PATCH_LENGTH = 64; 267 | const int PATCH_PER_ROW = IMG_LENGTH / PATCH_LENGTH; 268 | const int PATCH_PER_COL = IMG_LENGTH / PATCH_LENGTH; 269 | const int PATCH_PER_IMG = PATCH_PER_ROW * PATCH_PER_COL; 270 | 271 | const string ALL_MATCH_FILES [9] = {"m50_1000_1000_0.txt", "m50_2000_2000_0.txt", "m50_5000_5000_0.txt", 272 | "m50_10000_10000_0.txt", "m50_20000_20000_0.txt", "m50_50000_50000_0.txt", 273 | "m50_100000_100000_0.txt","m50_200000_200000_0.txt", "m50_500000_500000_0.txt"}; 274 | 275 | #endif 276 | 277 | -------------------------------------------------------------------------------- /include/MyDescriptors.h: -------------------------------------------------------------------------------- 1 | /* 2 | Intensity Order based Local Features 3 | https://github.com/foelin/IntensityOrderFeature 4 | 5 | Reference: 6 | [1] Zhenhua Wang, Bin Fan and Fuchao Wu, “Local Intensity Order Pattern for Feature Description”, 7 | IEEE International Conference on Computer Vision (ICCV) , Nov. 2011 8 | [2] Zhenhua Wang, Bin Fan, Gang Wang and Fuchao Wu, “Exploring Local and Overall Ordinal Information for Robust Feature Description”, 9 | IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), Dec. 2016. 10 | 11 | Contact: zhwang.me@gmail.com 12 | 13 | This is a free software. 14 | You can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation, either version 3 of the License, or 17 | (at your option) any later version. 18 | You should have received a copy of the GNU General Public License 19 | along with this software. If not, see . 20 | */ 21 | 22 | 23 | 24 | #ifndef _MY_DESCRIPTORS_H 25 | #define _MY_DESCRIPTORS_H 26 | 27 | #include "Common.h" 28 | #include "opencv2/opencv.hpp" 29 | #include 30 | 31 | using namespace cv; 32 | using namespace std; 33 | 34 | 35 | class MyDescriptors 36 | { 37 | public: 38 | MyDescriptors(Params& params); 39 | virtual ~MyDescriptors(void); 40 | 41 | virtual int descriptorSize() const; 42 | virtual int descriptorType() const; 43 | 44 | 45 | void compute( const Mat& image, CV_OUT CV_IN_OUT vector& keypoints, CV_OUT Mat& descriptors ) const; 46 | 47 | void computePatchImage(const Mat& image, int patch_per_row, int patch_per_col, int patch_length, int max_patch_num, Mat& descriptors) const; 48 | 49 | protected: 50 | 51 | virtual void computeImpl(const Mat& image, vector& keypoints, Mat& descriptors ) const; 52 | 53 | 54 | void createLIOP (const Mat& outPatch, const Mat& flagPatch, int inPatchSz, float* des) const;; 55 | void createOIOP (const Mat& outPatch, const Mat& flagPatch, int inPatchSz, float* des) const; 56 | void createMIOP (const Mat& outPatch, const Mat& flagPatch, int inPatchSz, float* des) const; 57 | void createMIOP_FAST(const Mat& outPatch, const Mat& flagPatch, int inPatchSz, float* des) const; 58 | 59 | void removeOutBound(const Mat& image, const vector& keypoints, vector& keypointsInBounds) const; 60 | bool readPCA(const string& file); 61 | 62 | 63 | 64 | private: 65 | int m_dim; 66 | int m_bytes; 67 | int m_dataType; 68 | Params& m_params; 69 | bool m_computeDomiOri; 70 | 71 | Mat m_PCABasis; //each row vector is a orthon basis 72 | Mat m_PCAMean; //a row vector 73 | const float* m_fenceRatio; 74 | 75 | 76 | void (MyDescriptors::*m_ptrCreateFeatFunc)(const Mat& outPatch, const Mat& flagPatch, int inPatchSz, float* des) const; 77 | }; 78 | 79 | 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /include/Utils.h: -------------------------------------------------------------------------------- 1 | #ifndef _UTILS_H_ 2 | #define _UTILS_H_ 3 | 4 | 5 | #include "Common.h" 6 | #include 7 | #include 8 | 9 | 10 | using namespace std; 11 | using namespace cv; 12 | 13 | bool NormalizePatch_ROI(const Mat& image, Mat& outPatch, Mat& flagPatch, const AffineKeyPoint& kp, const float origTrans[4], const float axis[2], float mrScale, int normPatchWidth, float initSigma, float domiOrien); 14 | void ThreshNorm(float* des, int dim, float thresh); 15 | 16 | inline float BilinearInterU2F(float x, float y, const Mat& image); 17 | inline float BilinearInterF2F(float x, float y, const Mat& image); 18 | bool BilinearInterF2FValid(float* val, float x, float y, const Mat& image, const Mat& flagImage); 19 | 20 | void CalTrans(const AffineKeyPoint& kp, float trans[4], float axis[2]); 21 | 22 | bool ReadKpts(const string& region_file, vector&kpts); 23 | void WriteDess(const string& des_file, const vector&kpts, const Mat& dess, DES_FORMAT desFormat); 24 | 25 | 26 | bool fGrayComp(Pixel p1, Pixel p2); 27 | void SortGray(float* dst, int* idx, float* src, int len); 28 | 29 | 30 | void ReadMatchInfo(const string& match_file, vector& match_info_vec); 31 | bool ReadImgList(const string& img_list_file, vector& img_file_list); 32 | void GetKpList(const string& kp_ext, const vector img_file_list, vector& kp_file_list); 33 | 34 | void ReadMatrix(ifstream& ifs, Mat& mat); 35 | void WriteMatrix(ofstream& ofs, const Mat& mat); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Utils.h" 3 | 4 | int main(int argc, char* argv[]) 5 | { 6 | char* img_file = NULL; 7 | char* region_file = NULL; 8 | char* des_file = NULL; 9 | 10 | Params params; 11 | 12 | /************************* Parsing the arguments *****************************/ 13 | int counter=0; 14 | while( ++counter < argc ) 15 | { 16 | if( !strcmp("-type", argv[counter] )) 17 | { 18 | counter++; 19 | 20 | if(strcmp(argv[counter], "liop") == 0) 21 | { 22 | params.des_type = LIOP; 23 | } 24 | else if(strcmp(argv[counter], "oiop") == 0) 25 | { 26 | params.des_type = OIOP; 27 | } 28 | else if (strcmp(argv[counter], "miop") == 0) 29 | { 30 | params.des_type = MIOP; 31 | } 32 | else if (strcmp(argv[counter], "miop_fast") == 0) 33 | { 34 | params.des_type = MIOP_FAST; 35 | } 36 | else 37 | { cerr << "Invalid type argument!" << endl; 38 | cout << "it must be csgp_kd or csgp_go!\n" << endl; 39 | return -1; 40 | 41 | } 42 | continue; 43 | } 44 | 45 | if( !strcmp("-img", argv[counter] )) 46 | { 47 | img_file = argv[++counter]; 48 | continue; 49 | } 50 | 51 | if( !strcmp("-region", argv[counter] )) 52 | { 53 | region_file = argv[++counter]; 54 | continue; 55 | } 56 | 57 | if( !strcmp("-des", argv[counter] )) 58 | { 59 | des_file = argv[++counter]; 60 | continue; 61 | } 62 | 63 | if( !strcmp("-initSigma", argv[counter] )) 64 | { 65 | params.initSigma= (double)atof(argv[++counter]); 66 | continue; 67 | } 68 | 69 | if( !strcmp("-srNum", argv[counter] )) 70 | { 71 | params.srNum = (int)atoi(argv[++counter]); 72 | continue; 73 | } 74 | 75 | if( !strcmp("-liopType", argv[counter] )) 76 | { 77 | params.liopType = (int)atoi(argv[++counter]); 78 | continue; 79 | } 80 | 81 | if( !strcmp("-liopRegionNum", argv[counter] )) 82 | { 83 | params.liopRegionNum = (int)atoi(argv[++counter]); 84 | continue; 85 | } 86 | 87 | if( !strcmp("-liopNum", argv[counter] )) 88 | { 89 | params.liopNum = (int)atoi(argv[++counter]); 90 | GeneratePatternMap(¶ms.pLiopPatternMap, ¶ms.pLiopPosWeight, params.liopNum); 91 | if (params.liopNum != 3 && params.liopNum != 4) 92 | { 93 | cerr << "Invalid command line argument: \"" << argv[counter] <<"\""<< endl; 94 | cerr << "The liopNum should be 3 or 4. " << endl; 95 | return -1; 96 | } 97 | continue; 98 | } 99 | 100 | if( !strcmp("-oiopType", argv[counter] )) 101 | { 102 | params.oiopType = (int)atoi(argv[++counter]); 103 | continue; 104 | } 105 | 106 | if( !strcmp("-oiopRegionNum", argv[counter] )) 107 | { 108 | params.oiopRegionNum = (int)atoi(argv[++counter]); 109 | continue; 110 | } 111 | 112 | if( !strcmp("-oiopQuantLevel", argv[counter] )) 113 | { 114 | params.oiopQuantLevel = (int)atoi(argv[++counter]); 115 | continue; 116 | } 117 | 118 | if( !strcmp("-oiopNum", argv[counter] )) 119 | { 120 | params.oiopNum = (int)atoi(argv[++counter]); 121 | 122 | if (params.oiopNum != 2 && params.oiopNum != 3) 123 | { 124 | cerr << "Invalid command line argument: \"" << argv[counter] <<"\""<< endl; 125 | cerr << "The oiopNum should be 2 or 3. " << endl; 126 | return -1; 127 | 128 | } 129 | continue; 130 | } 131 | 132 | if( !strcmp("-lsRadius", argv[counter] )) 133 | { 134 | params.lsRadius = (int)atoi(argv[++counter]); 135 | continue; 136 | } 137 | 138 | if( !strcmp("-normPatchWidth", argv[counter] )) 139 | { 140 | params.normPatchWidth = (int)atoi(argv[++counter]); 141 | continue; 142 | } 143 | 144 | if( !strcmp("-nSigma", argv[counter] )) 145 | { 146 | params.nSigma = (double)atof(argv[++counter]); 147 | continue; 148 | } 149 | 150 | if( !strcmp("-liopThre", argv[counter] )) 151 | { 152 | params.liopThre = (double)atof(argv[++counter]); 153 | continue; 154 | } 155 | 156 | if( !strcmp("-pcaFile", argv[counter] )) 157 | { 158 | params.PCAFile.assign(argv[++counter]); 159 | continue; 160 | } 161 | 162 | if( !strcmp("-pcaBasisNum", argv[counter] )) 163 | { 164 | params.PCABasisNum = atoi(argv[++counter]); 165 | continue; 166 | } 167 | 168 | if( !strcmp("-isApplyPCA", argv[counter] )) 169 | { 170 | params.isApplyPCA = (int)atoi(argv[++counter]); 171 | continue; 172 | } 173 | 174 | cerr << "Invalid command line argument: \"" << argv[counter] <<"\""<< endl; 175 | return -1; 176 | } 177 | 178 | //ensure normPatchWidth is odd 179 | if(params.normPatchWidth%2 == 0) 180 | params.normPatchWidth++; 181 | 182 | if ((params.des_type == MIOP || params.des_type == MIOP_FAST) && params.isApplyPCA) 183 | { 184 | params.desFormat = DES_FLOAT; 185 | } 186 | 187 | vector kpts; 188 | Mat dess; 189 | 190 | //read image and affine regions 191 | Mat img = imread(img_file, IMREAD_GRAYSCALE); 192 | if (params.initSigma > 0) 193 | { 194 | GaussianBlur(img, img, Size(0, 0), params.initSigma); 195 | } 196 | ReadKpts(region_file, kpts); 197 | 198 | //extract descriptors 199 | MyDescriptors commonDes(params); 200 | commonDes.compute(img, kpts, dess); 201 | WriteDess(des_file, kpts, dess, params.desFormat); 202 | 203 | return 0; 204 | } 205 | -------------------------------------------------------------------------------- /src/MyDescriptors.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Utils.h" 3 | #include 4 | 5 | //Below are learned normalized quantization locations for OIOP 6 | // when oiopNum = 3 7 | const float oiop_fence33_o3[3*2] = { 8 | 0.169, 0.405, 9 | 0.372, 0.623, 10 | 0.592, 0.828}; 11 | 12 | 13 | const float oiop_fence34_o3[3*3] = { 14 | 0.124, 0.273, 0.492, 15 | 0.302, 0.498, 0.694, 16 | 0.504, 0.725, 0.874}; 17 | 18 | 19 | const float oiop_fence43_o3[4*2] = { 20 | 0.149, 0.372, 21 | 0.300, 0.545, 22 | 0.451, 0.697, 23 | 0.625, 0.850}; 24 | 25 | const float oiop_fence44_o3[4*3] = { 26 | 0.107, 0.243, 0.459, 27 | 0.238, 0.417, 0.622, 28 | 0.374, 0.579, 0.760, 29 | 0.537, 0.755, 0.891}; 30 | 31 | 32 | const float oiop_fence53_o3[5*2] = { 33 | 0.136, 0.352, 34 | 0.254, 0.495, 35 | 0.376, 0.619, 36 | 0.502, 0.744, 37 | 0.645, 0.863 }; 38 | 39 | const float oiop_fence54_o3 [5*3] = { 40 | 0.098, 0.226, 0.440, 41 | 0.198, 0.366, 0.577, 42 | 0.307, 0.498, 0.688, 43 | 0.420, 0.632, 0.800, 44 | 0.555, 0.772, 0.901}; 45 | 46 | //////////////////// 47 | // when oiopNum = 2 48 | const float oiop_fence33_o2[3*2] = { 49 | 0.169, 0.427, 50 | 0.372, 0.641, 51 | 0.593, 0.840 }; 52 | 53 | 54 | const float oiop_fence34_o2[3*3] = { 55 | 0.122, 0.278, 0.526, 56 | 0.298, 0.506, 0.714, 57 | 0.495, 0.737, 0.885}; 58 | 59 | 60 | const float oiop_fence43_o2[4*2] = { 61 | 0.146, 0.391, 62 | 0.302, 0.570, 63 | 0.446, 0.709, 64 | 0.629, 0.862}; 65 | 66 | 67 | const float oiop_fence44_o2[4*3] = { 68 | 0.104, 0.247, 0.492, 69 | 0.239, 0.428, 0.652, 70 | 0.364, 0.586, 0.772, 71 | 0.530, 0.768, 0.903 }; 72 | 73 | 74 | const float oiop_fence53_o2[5*2] = { 75 | 0.132, 0.369, 76 | 0.258, 0.522, 77 | 0.375, 0.636, 78 | 0.496, 0.753, 79 | 0.651, 0.876}; 80 | 81 | const float oiop_fence54_o2[5*3] = { 82 | 0.093, 0.228, 0.471, 83 | 0.200, 0.376, 0.611, 84 | 0.303, 0.506, 0.710, 85 | 0.407, 0.639, 0.808, 86 | 0.551, 0.787, 0.913}; 87 | 88 | 89 | const int MAX_REGION_NUM = 10; 90 | const int MAX_SAMPLE_NUM = 10; 91 | 92 | MyDescriptors::MyDescriptors(Params& params) 93 | :m_params(params) 94 | { 95 | 96 | if (m_params.isApplyPCA) 97 | { 98 | if(!readPCA(m_params.PCAFile)) 99 | { 100 | cout<<"Can NOT read the PCA file"<& keypoints, Mat& descriptors ) const 287 | { 288 | if( image.empty() || keypoints.empty() ) 289 | { 290 | descriptors.release(); 291 | return; 292 | } 293 | 294 | computeImpl( image, keypoints, descriptors ); 295 | } 296 | 297 | int MyDescriptors::descriptorSize() const 298 | { 299 | return m_bytes; 300 | } 301 | 302 | int MyDescriptors::descriptorType() const 303 | { 304 | return m_dataType; 305 | } 306 | 307 | //To extract descriptors on affine covariant regions 308 | void MyDescriptors::computeImpl( const Mat& image, vector& keypoints, Mat& descriptors ) const 309 | { 310 | #ifdef TEST_TIME 311 | clock_t start, finish; 312 | double time; 313 | start = clock(); 314 | 315 | #endif 316 | int num = keypoints.size(); 317 | descriptors = Mat::zeros(num, m_dim, CV_32F); 318 | float* des_data = (float*)descriptors.data; 319 | int des_step = descriptors.step1(); 320 | 321 | 322 | //To add some borders to avoid border effect only. Actually we use the inside patch to extract descriptor 323 | int outPatchWidth = m_params.normPatchWidth+16; 324 | if(outPatchWidth%2 == 0) 325 | outPatchWidth++; 326 | 327 | for (int i=0; i 0) 345 | { 346 | GaussianBlur(outPatch, outPatch, Size(0, 0), m_params.nSigma); 347 | } 348 | 349 | (this->*m_ptrCreateFeatFunc)(outPatch, flagPatch, m_params.normPatchWidth, des_data+i*des_step+k*single_dim); 350 | 351 | } 352 | } 353 | 354 | 355 | #ifdef TEST_TIME 356 | finish = clock(); 357 | time = (double)(finish - start) / CLOCKS_PER_SEC; 358 | cout << "used " << time << " s for describe " <= max_patch_num) 417 | break; 418 | 419 | Rect roi_rec(c*patch_length,r*patch_length,patch_length,patch_length); 420 | image(roi_rec).convertTo(outPatch, CV_32FC1,1/255.0); 421 | if (m_params.nSigma > 0) 422 | { 423 | GaussianBlur(outPatch, outPatch, Size(0, 0), m_params.nSigma); 424 | } 425 | 426 | 427 | (this->*m_ptrCreateFeatFunc)(outPatch, flagPatch, inPatchSz, des_data); 428 | 429 | des_data += des_step; 430 | 431 | count++; 432 | } 433 | 434 | if (count >= max_patch_num) 435 | break; 436 | 437 | } 438 | 439 | 440 | if (m_params.isApplyPCA) 441 | { 442 | if(m_params.srNum == 1) 443 | { 444 | Mat desMean; 445 | repeat(m_PCAMean,max_patch_num,1,desMean); 446 | descriptors = (descriptors - desMean)*m_PCABasis; 447 | } 448 | else 449 | { 450 | Mat desMean; 451 | repeat(m_PCAMean,max_patch_num,1,desMean); 452 | 453 | Mat pcaDescriptors = Mat::zeros(max_patch_num, m_PCABasis.cols*m_params.srNum, CV_32F); 454 | 455 | int single_dim = m_dim/m_params.srNum; 456 | for(int k=0; k& keypoints, vector& keypointsInBounds) const 473 | { 474 | int num = keypoints.size(); 475 | keypointsInBounds.reserve(num); 476 | for (int i=0; i inRadius2) 543 | { 544 | continue; 545 | } 546 | 547 | float cur_gray = out_data [(y+outRadius)*out_step +x+outRadius]; 548 | uchar cur_flag = flag_data[(y+outRadius)*flag_step+x+outRadius]; 549 | if (cur_flag == 0) 550 | { 551 | continue; 552 | } 553 | 554 | float nDirX = x; 555 | float nDirY = y; 556 | float nOri = atan2(nDirY, nDirX); 557 | if (fabs(nOri - CV_PI) < INFMIN_F) 558 | { 559 | nOri = -CV_PI; 560 | } 561 | 562 | bool isInBound = true; 563 | for (k=0; k::iterator iter; 593 | iter = m_params.pLiopPatternMap->find(key); 594 | 595 | Pixel pix; 596 | pix.x = x; 597 | pix.y = y; 598 | pix.f_gray = cur_gray; 599 | pix.i_gray = (int)(pix.f_gray*255+0.5f); 600 | pix.weight = 1; 601 | pix.l_pattern = iter->second; 602 | pixel[pixelCount++] = pix; 603 | } 604 | } 605 | 606 | 607 | sort(pixel, pixel+pixelCount, fGrayComp); 608 | 609 | int l_patternWidth = m_params.liopNum == 3 ? 6 : 24; 610 | int dim = l_patternWidth*m_params.liopRegionNum; 611 | 612 | if (pixelCount >= m_params.liopRegionNum) 613 | { 614 | 615 | int curId = 0; 616 | int lastId = 0; 617 | for (i=0; ifenceGray) 640 | break; 641 | 642 | int id = regionId*l_patternWidth+pixel[curId].l_pattern; 643 | des[id] += pixel[curId].weight; 644 | curId++; 645 | } 646 | } 647 | 648 | ThreshNorm(des,dim,1.f); 649 | } 650 | 651 | } 652 | break; 653 | 654 | case 2: 655 | { 656 | 657 | // normalize the gray values 658 | float max_gray = 0.f; 659 | float min_gray = 1.f; 660 | 661 | for (y=-outRadius; y<=outRadius; ++y) 662 | { 663 | for (x=-outRadius; x<=outRadius; ++x) 664 | { 665 | float cur_gray = out_data [(y+outRadius)*out_step +x+outRadius]; 666 | uchar cur_flag = flag_data[(y+outRadius)*flag_step+x+outRadius]; 667 | if (cur_flag == 0) 668 | { 669 | continue; 670 | } 671 | 672 | if (cur_gray > max_gray) 673 | { 674 | max_gray = cur_gray; 675 | } 676 | 677 | if (cur_gray < min_gray) 678 | { 679 | min_gray = cur_gray; 680 | } 681 | 682 | } 683 | } 684 | 685 | float dif_gray = max_gray - min_gray; 686 | if (dif_gray < INFMIN_F) 687 | { 688 | dif_gray = INFMIN_F; 689 | } 690 | 691 | for (y=-inRadius_left; y<=inRadius_right; ++y) 692 | { 693 | for (x=-inRadius_left; x<=inRadius_right; ++x) 694 | { 695 | 696 | float dis2 = (float)(x*x + y*y); 697 | if(dis2 > inRadius2) 698 | { 699 | continue; 700 | } 701 | 702 | float cur_gray = out_data [(y+outRadius)*out_step +x+outRadius]; 703 | uchar cur_flag = flag_data[(y+outRadius)*flag_step+x+outRadius]; 704 | if (cur_flag == 0) 705 | { 706 | continue; 707 | } 708 | 709 | float nDirX = x; 710 | float nDirY = y; 711 | float nOri = atan2(nDirY, nDirX); 712 | if (fabs(nOri - CV_PI) < INFMIN_F) 713 | { 714 | nOri = -CV_PI; 715 | } 716 | 717 | 718 | bool isInBound = true; 719 | for (k=0; k::iterator iter; 749 | iter = m_params.pLiopPatternMap->find(key); 750 | 751 | float thre = m_params.liopThre/255.0; 752 | float dif = 0.0; 753 | int count = 0; 754 | for (i=m_params.liopNum-1; i>0; i--) 755 | { 756 | for (k=i-1; k>=0; k--) 757 | { 758 | dif = fabs(dst[i] - dst[k]); 759 | if (dif>thre) 760 | { 761 | count ++; 762 | } 763 | } 764 | } 765 | 766 | float weight = count+1; 767 | 768 | Pixel pix; 769 | pix.x = x; 770 | pix.y = y; 771 | pix.f_gray = cur_gray; 772 | pix.i_gray = (int)(pix.f_gray*255+0.5f); 773 | pix.weight = weight; 774 | pix.l_pattern = iter->second; 775 | pix.id = pixelCount; 776 | pixel[pixelCount++] = pix; 777 | } 778 | } 779 | 780 | 781 | sort(pixel, pixel+pixelCount, fGrayComp); 782 | 783 | int l_patternWidth = m_params.liopNum == 3 ? 6 : 24; 784 | int dim = l_patternWidth*m_params.liopRegionNum; 785 | 786 | if (pixelCount >= m_params.liopRegionNum) 787 | { 788 | int curId = 0; 789 | int lastId = 0; 790 | for (i=0; ifenceGray) 813 | break; 814 | 815 | int id = regionId*l_patternWidth+pixel[curId].l_pattern; 816 | des[id] += pixel[curId].weight; 817 | curId++; 818 | } 819 | } 820 | 821 | ThreshNorm(des,dim, 1.f); 822 | } 823 | 824 | } 825 | break; 826 | 827 | default: 828 | printf("undefined case!\n"); 829 | exit(0); 830 | } 831 | 832 | delete [] pixel; 833 | } 834 | 835 | 836 | /* 837 | case 1 learning based quantization as described in PAMI paper 838 | case 2 standard quantization 839 | */ 840 | 841 | void MyDescriptors::createOIOP(const Mat& outPatch, const Mat& flagPatch, int inPatchSz, float* des) const 842 | { 843 | 844 | int i,j,k,x,y; 845 | 846 | float* out_data = (float *)outPatch.data; 847 | int out_step = outPatch.step1(); 848 | uchar* flag_data = (uchar*)flagPatch.data; 849 | int flag_step = flagPatch.step1(); 850 | 851 | int inRadius_left = inPatchSz/2; 852 | int inRadius_right = inPatchSz - inRadius_left - 1; 853 | float inRadius2 = (float)(inRadius_left*inRadius_left); 854 | 855 | int outRadius = outPatch.cols / 2; 856 | 857 | Pixel* pixel = new Pixel[inPatchSz*inPatchSz]; 858 | 859 | switch (m_params.oiopType) 860 | { 861 | 862 | case 1: 863 | { 864 | 865 | int sampleNum = m_params.oiopNum; 866 | Mat pixelSample(sampleNum,inPatchSz*inPatchSz,CV_32FC1); 867 | float* pixelSample_data = (float*)pixelSample.data; 868 | int pixelSample_step = pixelSample.step1(); 869 | 870 | float theta = 2*CV_PI/m_params.oiopNum; 871 | int pixelCount = 0; 872 | for (y=-inRadius_left; y<=inRadius_right; ++y) 873 | { 874 | for (x=-inRadius_left; x<=inRadius_right; ++x) 875 | { 876 | float dis2 = (float)(x*x + y*y); 877 | if(dis2 > inRadius2) 878 | { 879 | continue; 880 | } 881 | 882 | float cur_gray = out_data[(y+outRadius)*out_step+x+outRadius]; 883 | uchar cur_flag = flag_data[(y+outRadius)*flag_step+x+outRadius]; 884 | if (cur_flag == 0) 885 | { 886 | continue; 887 | } 888 | 889 | float nDirX = x; 890 | float nDirY = y; 891 | float nOri = atan2(nDirY, nDirX); 892 | if (fabs(nOri - CV_PI) < INFMIN_F) 893 | { 894 | nOri = -CV_PI; 895 | } 896 | 897 | bool isInBound = true; 898 | int radius = m_params.lsRadius; 899 | 900 | for (k=0; k= m_params.oiopRegionNum) 979 | { 980 | 981 | 982 | for (i=0; ifenceGray) 1005 | break; 1006 | 1007 | int id = regionId*o_patternWidth+pixel[curId].o_pattern; 1008 | des[id] += pixel[curId].weight; 1009 | curId++; 1010 | } 1011 | } 1012 | ThreshNorm(des,dim, 1.f); 1013 | } 1014 | 1015 | } 1016 | break; 1017 | 1018 | 1019 | 1020 | case 2: 1021 | { 1022 | 1023 | int sampleNum = m_params.oiopNum; 1024 | Mat pixelSample(sampleNum,inPatchSz*inPatchSz,CV_32FC1); 1025 | float* pixelSample_data = (float*)pixelSample.data; 1026 | int pixelSample_step = pixelSample.step1(); 1027 | 1028 | float theta = 2*CV_PI/m_params.oiopNum; 1029 | int pixelCount = 0; 1030 | 1031 | for (y=-inRadius_left; y<=inRadius_right; ++y) 1032 | { 1033 | for (x=-inRadius_left; x<=inRadius_right; ++x) 1034 | { 1035 | float dis2 = (float)(x*x + y*y); 1036 | if(dis2 > inRadius2) 1037 | { 1038 | continue; 1039 | } 1040 | 1041 | float cur_gray = out_data[(y+outRadius)*out_step+x+outRadius]; 1042 | uchar cur_flag = flag_data[(y+outRadius)*flag_step+x+outRadius]; 1043 | if (cur_flag == 0) 1044 | { 1045 | continue; 1046 | } 1047 | 1048 | float nDirX = x; 1049 | float nDirY = y; 1050 | float nOri = atan2(nDirY, nDirX); 1051 | if (fabs(nOri - CV_PI) < INFMIN_F) 1052 | { 1053 | nOri = -CV_PI; 1054 | } 1055 | 1056 | bool isInBound = true; 1057 | int radius = m_params.lsRadius; 1058 | for (k=0; k= m_params.oiopRegionNum) 1128 | { 1129 | 1130 | int curId = 0; 1131 | int lastId = 0; 1132 | for (i=0; ifenceGray) 1155 | break; 1156 | 1157 | int id = regionId*o_patternWidth+pixel[curId].o_pattern; 1158 | des[id] += pixel[curId].weight; 1159 | curId++; 1160 | } 1161 | } 1162 | 1163 | ThreshNorm(des,dim, 1.f); 1164 | } 1165 | } 1166 | break; 1167 | 1168 | 1169 | } 1170 | 1171 | delete [] pixel; 1172 | } 1173 | 1174 | //simply implementation of MIOP without considering speed issue 1175 | void MyDescriptors::createMIOP(const Mat& outPatch, const Mat& flagPatch, int inPatchSz, float* des) const 1176 | { 1177 | int l_patternWidth = m_params.liopNum == 3 ? 6 : 24; 1178 | int liop_dim = (l_patternWidth*m_params.liopRegionNum); 1179 | 1180 | createLIOP(outPatch, flagPatch, inPatchSz, des); 1181 | createOIOP(outPatch, flagPatch, inPatchSz, des+liop_dim); 1182 | } 1183 | 1184 | 1185 | //liopType=1:LIOP + oiopType=12:OIOP, fast implementation, share the global order 1186 | void MyDescriptors::createMIOP_FAST(const Mat& outPatch, const Mat& flagPatch, int inPatchSz, float* des) const 1187 | { 1188 | int i,j,k,x,y; 1189 | 1190 | float* out_data = (float *)outPatch.data; 1191 | int out_step = outPatch.step1(); 1192 | uchar* flag_data = (uchar*)flagPatch.data; 1193 | int flag_step = flagPatch.step1(); 1194 | 1195 | int inRadius_left = inPatchSz/2; 1196 | int inRadius_right = inPatchSz - inRadius_left - 1; 1197 | float inRadius2 = (float)(inRadius_left*inRadius_left); 1198 | 1199 | int outRadius = outPatch.cols / 2; 1200 | 1201 | Pixel* pixel = new Pixel[inPatchSz*inPatchSz]; 1202 | 1203 | //for liop 1204 | int liop_idx[MAX_SAMPLE_NUM]; 1205 | float liop_dst[MAX_SAMPLE_NUM]; 1206 | float liop_src[MAX_SAMPLE_NUM]; 1207 | float liop_theta = 2*CV_PI/m_params.liopNum; 1208 | 1209 | //for oiop 1210 | float oiop_theta = 2*CV_PI/m_params.oiopNum; 1211 | 1212 | Mat pixelSample(m_params.oiopNum,inPatchSz*inPatchSz,CV_32FC1); 1213 | float* pixelSample_data = (float*)pixelSample.data; 1214 | int pixelSample_step = pixelSample.step1(); 1215 | 1216 | 1217 | int pixelCount = 0; 1218 | for (y=-inRadius_left; y<=inRadius_right; ++y) 1219 | { 1220 | for (x=-inRadius_left; x<=inRadius_right; ++x) 1221 | { 1222 | 1223 | float dis2 = (float)(x*x + y*y); 1224 | if(dis2 > inRadius2) 1225 | { 1226 | continue; 1227 | } 1228 | 1229 | float cur_gray = out_data [(y+outRadius)*out_step +x+outRadius]; 1230 | uchar cur_flag = flag_data[(y+outRadius)*flag_step+x+outRadius]; 1231 | if (cur_flag == 0) 1232 | { 1233 | continue; 1234 | } 1235 | 1236 | float nDirX = x; 1237 | float nDirY = y; 1238 | float nOri = atan2(nDirY, nDirX); 1239 | if (fabs(nOri - CV_PI) < INFMIN_F) 1240 | { 1241 | nOri = -CV_PI; 1242 | } 1243 | 1244 | //for liop 1245 | bool isInBound = true; 1246 | for (k=0; k::iterator iter; 1304 | iter = m_params.pLiopPatternMap->find(key); 1305 | 1306 | Pixel pix; 1307 | pix.x = x; 1308 | pix.y = y; 1309 | pix.f_gray = cur_gray; 1310 | pix.i_gray = (int)(pix.f_gray*255+0.5f); 1311 | pix.weight = 1; 1312 | pix.l_pattern = iter->second; 1313 | pix.id = pixelCount; 1314 | pix.o_pattern = 0; 1315 | pixel[pixelCount++] = pix; 1316 | } 1317 | } 1318 | 1319 | sort(pixel, pixel+pixelCount, fGrayComp); 1320 | 1321 | //for liop 1322 | int l_patternWidth = m_params.liopNum == 3 ? 6 : 24; 1323 | int liop_dim = l_patternWidth*m_params.liopRegionNum; 1324 | 1325 | if (pixelCount >= m_params.liopRegionNum) 1326 | { 1327 | int curId = 0; 1328 | int lastId = 0; 1329 | for (i=0; ifenceGray) 1352 | break; 1353 | 1354 | int id = regionId*l_patternWidth+pixel[curId].l_pattern; 1355 | des[id] += pixel[curId].weight; 1356 | curId++; 1357 | } 1358 | } 1359 | 1360 | ThreshNorm(des,liop_dim,1.f); 1361 | } 1362 | 1363 | //for oiop 1364 | float subFenceGray[MAX_REGION_NUM][MAX_REGION_NUM]; 1365 | int fenceNum = m_params.oiopQuantLevel-1; 1366 | 1367 | int subFenceId; 1368 | for (k=0; k= m_params.oiopRegionNum) 1406 | { 1407 | for (i=0; ifenceGray) 1430 | break; 1431 | 1432 | int id = regionId*l_patternWidth+pixel[curId].o_pattern; 1433 | oiop_des[id] += pixel[curId].weight; 1434 | curId++; 1435 | } 1436 | } 1437 | 1438 | ThreshNorm(oiop_des,oiop_dim, 1.f); 1439 | } 1440 | 1441 | delete [] pixel; 1442 | 1443 | } 1444 | 1445 | 1446 | bool MyDescriptors::readPCA(const string& file) 1447 | { 1448 | ifstream ifs(file.c_str()); 1449 | if (!ifs.is_open()) 1450 | { 1451 | cout<<"Can not read feature projection matrix: "< 0 ? orig_left_up_x : 0; 54 | roi_left_up_y = orig_left_up_y > 0 ? orig_left_up_y : 0; 55 | 56 | roi_right_bot_x = orig_right_bot_x < image.cols-1 ? orig_right_bot_x : image.cols-1; 57 | roi_right_bot_y = orig_right_bot_y < image.rows-1? orig_right_bot_y : image.rows-1; 58 | 59 | roi_width = roi_right_bot_x - roi_left_up_x + 1; 60 | roi_height = roi_right_bot_y - roi_left_up_y + 1; 61 | 62 | float new_x = kp.pt.x - roi_left_up_x; //feature loc in ROI 63 | float new_y = kp.pt.y - roi_left_up_y; //feature loc in ROI 64 | 65 | Rect roiRect(roi_left_up_x, roi_left_up_y, roi_width, roi_height); 66 | const Mat& roi = image(roiRect); 67 | 68 | Mat tempImg; 69 | //mrScale*sqrt(m_axis[0]*m_axis[1]) / (normPatchWidth/2) 70 | double kFactor = (mrScale*sqrt(axis[0]*axis[1]))/normPatchRadius; 71 | if(kFactor > 1.0)//when measureRegion.size > normPatch.size 72 | { 73 | //double kernel = sqrt(kFactor*kFactor-1)*params.initSigma; 74 | double kernel = sqrt(kFactor*kFactor-initSigma*initSigma); 75 | GaussianBlur(roi,tempImg, Size(0, 0),kernel); 76 | } 77 | else 78 | { 79 | roi.copyTo(tempImg); 80 | } 81 | 82 | int out_step = outPatch.step1(); 83 | float *out_data = (float*)outPatch.data; 84 | 85 | int flag_step = flagPatch.step1(); 86 | uchar *flag_data = (uchar*)flagPatch.data; 87 | 88 | bool isInBound = true; 89 | 90 | for (y=-outRadius; y<=outRadius; y++) 91 | { 92 | for (x=-outRadius; x<=outRadius; x++) 93 | { 94 | float x1 = trans[0] * x + trans[1] * y + new_x; 95 | float y1 = trans[2] * x + trans[3] * y + new_y; 96 | 97 | 98 | if (x1 < 0 || x1 > (tempImg.cols- 1) || y1 < 0 || y1 > (tempImg.rows - 1)) 99 | { 100 | out_data [(y + outRadius) * out_step + (x + outRadius)] = 0.0; 101 | flag_data[(y + outRadius) * flag_step + (x + outRadius)] = 0; 102 | isInBound = false; 103 | } 104 | else 105 | { 106 | out_data [(y + outRadius) * out_step + (x + outRadius)] = BilinearInterU2F(x1, y1, tempImg); 107 | flag_data[(y + outRadius) * flag_step + (x + outRadius)] = 255; 108 | } 109 | } 110 | } 111 | 112 | return isInBound; 113 | } 114 | 115 | 116 | /******************************************************************** 117 | To avoid linear illumination change, we normalize the descriptor. 118 | To avoid non-linear illumination change, we threshold the value 119 | of each descriptor element to 'illuThresh', then normalize again. 120 | ********************************************************************/ 121 | void ThreshNorm(float* des, int dim, float thresh) 122 | { 123 | // Normalize the descriptor, and threshold 124 | // value of each element to 'illuThresh'. 125 | 126 | float norm = 0.f; 127 | int i; 128 | 129 | for (i=0; i thresh) 144 | { 145 | des[i] = thresh; 146 | } 147 | } 148 | 149 | // Normalize again. 150 | 151 | norm = 0.f; 152 | 153 | for (i=0; i= 0 && y >= 0 && x<=image.cols-1 && y<=image.rows-1)); 170 | 171 | int x1 = (int)x; 172 | int y1 = (int)y; 173 | 174 | int x2, y2; 175 | if( x1 == image.cols-1) 176 | x2 = x1; 177 | else 178 | x2 = x1+1; 179 | 180 | if(y1 == image.rows-1) 181 | y2 = y1; 182 | else 183 | y2 = y1+1; 184 | 185 | int step = image.step; 186 | uchar* data = (uchar*)image.data; 187 | 188 | float val = 189 | (float)((x2 - x) * (y2 - y) * data[y1*step+x1] + 190 | (x - x1) * (y2 - y) * data[y1*step+x2] + 191 | (x2 - x) * (y - y1) * data[y2*step+x1] + 192 | (x - x1) * (y - y1) * data[y2*step+x2]) / 255.f; 193 | 194 | return val; 195 | } 196 | 197 | inline float BilinearInterF2F(float x, float y, const Mat& image) 198 | { 199 | assert((x >= 0 && y >= 0 && x<=image.cols-1 && y<=image.rows-1)); 200 | 201 | int x1 = (int)x; 202 | int y1 = (int)y; 203 | 204 | int x2, y2; 205 | if( x1 == image.cols-1) 206 | x2 = x1; 207 | else 208 | x2 = x1+1; 209 | 210 | if(y1 == image.rows-1) 211 | y2 = y1; 212 | else 213 | y2 = y1+1; 214 | 215 | int step = image.step / sizeof(float); 216 | float* data = (float*)image.data; 217 | 218 | float val = 219 | (x2 - x) * (y2 - y) * data[y1*step+x1] + 220 | (x - x1) * (y2 - y) * data[y1*step+x2] + 221 | (x2 - x) * (y - y1) * data[y2*step+x1] + 222 | (x - x1) * (y - y1) * data[y2*step+x2]; 223 | 224 | return val; 225 | } 226 | 227 | bool BilinearInterF2FValid(float* val, float x, float y, const Mat& image, const Mat& flagImage) 228 | { 229 | *val = 0.0; 230 | if(!(x >= 0 && y >= 0 && x<=image.cols-1 && y<=image.rows-1)) 231 | return false; 232 | 233 | int x1 = (int)x; 234 | int y1 = (int)y; 235 | 236 | int x2, y2; 237 | if( x1 == image.cols-1) 238 | x2 = x1; 239 | else 240 | x2 = x1+1; 241 | 242 | if(y1 == image.rows-1 ) 243 | y2 = y1; 244 | else 245 | y2 = y1+1; 246 | 247 | int step = image.step1(); 248 | float* data = (float*)image.data; 249 | 250 | int flag_step = flagImage.step1(); 251 | uchar* flag_data = (uchar*)flagImage.data; 252 | 253 | if(flag_data[y1*flag_step+x1] == 0 || flag_data[y1*flag_step+x2] == 0 || flag_data[y2*flag_step+x1] == 0 || flag_data[y2*flag_step+x2] == 0) 254 | return false; 255 | 256 | *val = 257 | (x2 - x) * (y2 - y) * data[y1*step+x1] + 258 | (x - x1) * (y2 - y) * data[y1*step+x2] + 259 | (x2 - x) * (y - y1) * data[y2*step+x1] + 260 | (x - x1) * (y - y1) * data[y2*step+x2]; 261 | return true; 262 | 263 | } 264 | 265 | //Compute the transformation for normalization from the ellips 266 | void CalTrans(const AffineKeyPoint& kp, float trans[4], float axis[2]) 267 | { 268 | Mat A(2,2, CV_32FC1); 269 | Mat eigenVals, eigenVects; 270 | 271 | float* A_data = (float*)A.data; 272 | A_data[0] = kp.a; 273 | A_data[1] = kp.b; 274 | A_data[2] = kp.b; 275 | A_data[3] = kp.c; 276 | 277 | eigen(A, eigenVals, eigenVects); 278 | float e1 = eigenVals.at(0);//larger 279 | float e2 = eigenVals.at(1);//smaller 280 | 281 | Mat eigenVals_sqrt_inv(2,2, CV_32FC1); 282 | float* eigenVals_sqrt_inv_data = (float*)eigenVals_sqrt_inv.data; 283 | eigenVals_sqrt_inv_data[0] = 1/sqrt(e1); 284 | eigenVals_sqrt_inv_data[1] = 0.f; 285 | eigenVals_sqrt_inv_data[2] = 0.f; 286 | eigenVals_sqrt_inv_data[3] = 1/sqrt(e2); 287 | 288 | axis[0] = eigenVals_sqrt_inv_data[3]; //long axis 289 | axis[1] = eigenVals_sqrt_inv_data[0]; //short axis 290 | 291 | A = eigenVects.t() * eigenVals_sqrt_inv * eigenVects; 292 | 293 | trans[0] = A_data[0]; 294 | trans[1] = A_data[1]; 295 | trans[2] = A_data[2]; 296 | trans[3] = A_data[3]; 297 | 298 | } 299 | 300 | bool ReadKpts(const string& fileName, vector&kpts) 301 | { 302 | // Open the file. 303 | ifstream file(fileName.c_str()); 304 | 305 | if (!file.is_open()) 306 | FatalError("Invalid file name!"); 307 | 308 | // Read format version. 309 | float version; 310 | file >> version; 311 | 312 | // Read the number 313 | int num; 314 | file >> num; 315 | kpts.reserve(num); 316 | 317 | if (fabs(version - 1.f) < 0.000001 ) 318 | { 319 | 320 | for (int i=0; i> kpt.pt.x >> kpt.pt.y>> kpt.a >> kpt.b >> kpt.c; 324 | kpts.push_back(kpt); 325 | } 326 | } 327 | else 328 | { 329 | string buf; 330 | for (int i=0; i> kpt.pt.x >> kpt.pt.y>> kpt.a >> kpt.b >> kpt.c; 334 | kpts.push_back(kpt); 335 | for(int j=0; j> buf; 337 | 338 | } 339 | } 340 | 341 | 342 | // Close the file. 343 | file.close(); 344 | return true; 345 | } 346 | 347 | void WriteDess(const string& fileName, const vector&kpts, const Mat& dess, DES_FORMAT desFormat) 348 | { 349 | 350 | 351 | // Open the file. 352 | ofstream file(fileName.c_str()); 353 | if (!file.is_open()) 354 | { 355 | FatalError("Invalid file name "); 356 | } 357 | 358 | int num = kpts.size(); 359 | int dim = dess.cols; 360 | 361 | file << dim << endl<< num <**pattern_map, int** pos_weight, int n) 408 | { 409 | int i, key, count; 410 | 411 | if(*pattern_map != NULL) 412 | { 413 | delete *pattern_map; 414 | } 415 | *pattern_map = new map(); 416 | map* temp_pattern_map = *pattern_map; 417 | 418 | if (*pos_weight != NULL) 419 | { 420 | delete [] *pos_weight; 421 | } 422 | *pos_weight = new int[n]; 423 | int* temp_pos_weight = *pos_weight; 424 | 425 | 426 | //do the job 427 | int *p = new int[n]; 428 | temp_pos_weight[0] = 1; 429 | for (i=1; iinsert(map::value_type(key,count)); 442 | count++; 443 | 444 | 445 | while(NextPermutation(p, n)) 446 | { 447 | key = 0; 448 | for (i = 0; i < n; i++) 449 | { 450 | key += p[i]*temp_pos_weight[n-i-1]; 451 | } 452 | temp_pattern_map->insert(map::value_type(key, count)); 453 | count++; 454 | } 455 | delete[] p; 456 | } 457 | 458 | bool NextPermutation(int *p, int n) 459 | { 460 | int last = n - 1; 461 | int i, j, k; 462 | 463 | 464 | i = last; 465 | while (i > 0 && p[i] < p[i - 1]) 466 | i--; 467 | 468 | if (i == 0) 469 | return false; 470 | 471 | k = i; 472 | for (j = last; j >= i; j--) 473 | if (p[j] > p[i - 1] && p[j] < p[k]) 474 | k = j; 475 | Swap(p[k], p[i - 1]); 476 | for (j = last, k = i; j > k; j--, k++) 477 | Swap(p[j], p[k]); 478 | 479 | return true; 480 | 481 | } 482 | 483 | bool fGrayComp(Pixel p1, Pixel p2) 484 | { 485 | return p1.f_gray < p2.f_gray; 486 | } 487 | 488 | //non-descending order 489 | void SortGray(float* dst, int* idx, float* src, int len) 490 | { 491 | int i, j; 492 | 493 | for (i=0; i& match_info_vec) 523 | { 524 | int no_use; 525 | 526 | 527 | ifstream ifs(match_file.c_str()); 528 | if (!ifs.is_open()) 529 | { 530 | cerr << "Can NOT open file"<> match_info.m_patchId1 ; 539 | 540 | if (ifs.eof()) 541 | break; 542 | 543 | ifs >> match_info.m_3dPointId1 >> no_use >> match_info.m_patchId2 >> match_info.m_3dPointId2 >> no_use >> match_info.isCorrect; 544 | 545 | match_info_vec.push_back(match_info); 546 | 547 | 548 | 549 | } 550 | ifs.close(); 551 | } 552 | 553 | 554 | 555 | 556 | bool ReadImgList(const string& img_list_file, vector& img_file_list) 557 | { 558 | ifstream ifs(img_list_file.c_str()); 559 | if (!ifs.is_open()) 560 | { 561 | cout<<"Can not read img_kp_list_file: "<>num; 571 | img_file_list.clear(); 572 | img_file_list.reserve(num); 573 | for(int i=0; i>img_file; 576 | img_file_list.push_back(img_file); 577 | } 578 | 579 | ifs.close(); 580 | return true; 581 | } 582 | 583 | void GetKpList(const string& kp_ext, const vector img_file_list, vector& kp_file_list) 584 | { 585 | int num = img_file_list.size(); 586 | kp_file_list.clear(); 587 | kp_file_list.reserve(num); 588 | for (int i=0; i>dim>>num; 601 | 602 | mat.create(dim, num, CV_32FC1); 603 | float* mat_data = (float*)mat.data; 604 | int mat_step = mat.step/sizeof(float); 605 | for (int i=0; i>mat_data[i*mat_step+j]; 610 | } 611 | } 612 | return; 613 | } 614 | 615 | void WriteMatrix(ofstream& ofs, const Mat& mat) 616 | { 617 | int dim = mat.rows; 618 | int num = mat.cols; 619 | ofs<