BVB Source Codes

jsfeat Show jsfeat_orb.js Source code

Return Download jsfeat: download jsfeat_orb.js Source code - Download jsfeat Source code - Type:.js
  1. /**
  2.  * @author Eugene Zatepyakin / http://inspirit.ru/
  3.  *
  4.  * Original implementation derived from OpenCV,
  5.  * @authors Ethan Rublee, Vincent Rabaud, Gary Bradski
  6.  */
  7.  
  8. (function(global) {
  9.     "use strict";
  10.     //
  11.  
  12.     var orb = (function() {
  13.  
  14.         var bit_pattern_31_ = new Int32Array([
  15.                     8,-3, 9,5/*mean (0), correlation (0)*/,
  16.                     4,2, 7,-12/*mean (1.12461e-05), correlation (0.0437584)*/,
  17.                     -11,9, -8,2/*mean (3.37382e-05), correlation (0.0617409)*/,
  18.                     7,-12, 12,-13/*mean (5.62303e-05), correlation (0.0636977)*/,
  19.                     2,-13, 2,12/*mean (0.000134953), correlation (0.085099)*/,
  20.                     1,-7, 1,6/*mean (0.000528565), correlation (0.0857175)*/,
  21.                     -2,-10, -2,-4/*mean (0.0188821), correlation (0.0985774)*/,
  22.                     -13,-13, -11,-8/*mean (0.0363135), correlation (0.0899616)*/,
  23.                     -13,-3, -12,-9/*mean (0.121806), correlation (0.099849)*/,
  24.                     10,4, 11,9/*mean (0.122065), correlation (0.093285)*/,
  25.                     -13,-8, -8,-9/*mean (0.162787), correlation (0.0942748)*/,
  26.                     -11,7, -9,12/*mean (0.21561), correlation (0.0974438)*/,
  27.                     7,7, 12,6/*mean (0.160583), correlation (0.130064)*/,
  28.                     -4,-5, -3,0/*mean (0.228171), correlation (0.132998)*/,
  29.                     -13,2, -12,-3/*mean (0.00997526), correlation (0.145926)*/,
  30.                     -9,0, -7,5/*mean (0.198234), correlation (0.143636)*/,
  31.                     12,-6, 12,-1/*mean (0.0676226), correlation (0.16689)*/,
  32.                     -3,6, -2,12/*mean (0.166847), correlation (0.171682)*/,
  33.                     -6,-13, -4,-8/*mean (0.101215), correlation (0.179716)*/,
  34.                     11,-13, 12,-8/*mean (0.200641), correlation (0.192279)*/,
  35.                     4,7, 5,1/*mean (0.205106), correlation (0.186848)*/,
  36.                     5,-3, 10,-3/*mean (0.234908), correlation (0.192319)*/,
  37.                     3,-7, 6,12/*mean (0.0709964), correlation (0.210872)*/,
  38.                     -8,-7, -6,-2/*mean (0.0939834), correlation (0.212589)*/,
  39.                     -2,11, -1,-10/*mean (0.127778), correlation (0.20866)*/,
  40.                     -13,12, -8,10/*mean (0.14783), correlation (0.206356)*/,
  41.                     -7,3, -5,-3/*mean (0.182141), correlation (0.198942)*/,
  42.                     -4,2, -3,7/*mean (0.188237), correlation (0.21384)*/,
  43.                     -10,-12, -6,11/*mean (0.14865), correlation (0.23571)*/,
  44.                     5,-12, 6,-7/*mean (0.222312), correlation (0.23324)*/,
  45.                     5,-6, 7,-1/*mean (0.229082), correlation (0.23389)*/,
  46.                     1,0, 4,-5/*mean (0.241577), correlation (0.215286)*/,
  47.                     9,11, 11,-13/*mean (0.00338507), correlation (0.251373)*/,
  48.                     4,7, 4,12/*mean (0.131005), correlation (0.257622)*/,
  49.                     2,-1, 4,4/*mean (0.152755), correlation (0.255205)*/,
  50.                     -4,-12, -2,7/*mean (0.182771), correlation (0.244867)*/,
  51.                     -8,-5, -7,-10/*mean (0.186898), correlation (0.23901)*/,
  52.                     4,11, 9,12/*mean (0.226226), correlation (0.258255)*/,
  53.                     0,-8, 1,-13/*mean (0.0897886), correlation (0.274827)*/,
  54.                     -13,-2, -8,2/*mean (0.148774), correlation (0.28065)*/,
  55.                     -3,-2, -2,3/*mean (0.153048), correlation (0.283063)*/,
  56.                     -6,9, -4,-9/*mean (0.169523), correlation (0.278248)*/,
  57.                     8,12, 10,7/*mean (0.225337), correlation (0.282851)*/,
  58.                     0,9, 1,3/*mean (0.226687), correlation (0.278734)*/,
  59.                     7,-5, 11,-10/*mean (0.00693882), correlation (0.305161)*/,
  60.                     -13,-6, -11,0/*mean (0.0227283), correlation (0.300181)*/,
  61.                     10,7, 12,1/*mean (0.125517), correlation (0.31089)*/,
  62.                     -6,-3, -6,12/*mean (0.131748), correlation (0.312779)*/,
  63.                     10,-9, 12,-4/*mean (0.144827), correlation (0.292797)*/,
  64.                     -13,8, -8,-12/*mean (0.149202), correlation (0.308918)*/,
  65.                     -13,0, -8,-4/*mean (0.160909), correlation (0.310013)*/,
  66.                     3,3, 7,8/*mean (0.177755), correlation (0.309394)*/,
  67.                     5,7, 10,-7/*mean (0.212337), correlation (0.310315)*/,
  68.                     -1,7, 1,-12/*mean (0.214429), correlation (0.311933)*/,
  69.                     3,-10, 5,6/*mean (0.235807), correlation (0.313104)*/,
  70.                     2,-4, 3,-10/*mean (0.00494827), correlation (0.344948)*/,
  71.                     -13,0, -13,5/*mean (0.0549145), correlation (0.344675)*/,
  72.                     -13,-7, -12,12/*mean (0.103385), correlation (0.342715)*/,
  73.                     -13,3, -11,8/*mean (0.134222), correlation (0.322922)*/,
  74.                     -7,12, -4,7/*mean (0.153284), correlation (0.337061)*/,
  75.                     6,-10, 12,8/*mean (0.154881), correlation (0.329257)*/,
  76.                     -9,-1, -7,-6/*mean (0.200967), correlation (0.33312)*/,
  77.                     -2,-5, 0,12/*mean (0.201518), correlation (0.340635)*/,
  78.                     -12,5, -7,5/*mean (0.207805), correlation (0.335631)*/,
  79.                     3,-10, 8,-13/*mean (0.224438), correlation (0.34504)*/,
  80.                     -7,-7, -4,5/*mean (0.239361), correlation (0.338053)*/,
  81.                     -3,-2, -1,-7/*mean (0.240744), correlation (0.344322)*/,
  82.                     2,9, 5,-11/*mean (0.242949), correlation (0.34145)*/,
  83.                     -11,-13, -5,-13/*mean (0.244028), correlation (0.336861)*/,
  84.                     -1,6, 0,-1/*mean (0.247571), correlation (0.343684)*/,
  85.                     5,-3, 5,2/*mean (0.000697256), correlation (0.357265)*/,
  86.                     -4,-13, -4,12/*mean (0.00213675), correlation (0.373827)*/,
  87.                     -9,-6, -9,6/*mean (0.0126856), correlation (0.373938)*/,
  88.                     -12,-10, -8,-4/*mean (0.0152497), correlation (0.364237)*/,
  89.                     10,2, 12,-3/*mean (0.0299933), correlation (0.345292)*/,
  90.                     7,12, 12,12/*mean (0.0307242), correlation (0.366299)*/,
  91.                     -7,-13, -6,5/*mean (0.0534975), correlation (0.368357)*/,
  92.                     -4,9, -3,4/*mean (0.099865), correlation (0.372276)*/,
  93.                     7,-1, 12,2/*mean (0.117083), correlation (0.364529)*/,
  94.                     -7,6, -5,1/*mean (0.126125), correlation (0.369606)*/,
  95.                     -13,11, -12,5/*mean (0.130364), correlation (0.358502)*/,
  96.                     -3,7, -2,-6/*mean (0.131691), correlation (0.375531)*/,
  97.                     7,-8, 12,-7/*mean (0.160166), correlation (0.379508)*/,
  98.                     -13,-7, -11,-12/*mean (0.167848), correlation (0.353343)*/,
  99.                     1,-3, 12,12/*mean (0.183378), correlation (0.371916)*/,
  100.                     2,-6, 3,0/*mean (0.228711), correlation (0.371761)*/,
  101.                     -4,3, -2,-13/*mean (0.247211), correlation (0.364063)*/,
  102.                     -1,-13, 1,9/*mean (0.249325), correlation (0.378139)*/,
  103.                     7,1, 8,-6/*mean (0.000652272), correlation (0.411682)*/,
  104.                     1,-1, 3,12/*mean (0.00248538), correlation (0.392988)*/,
  105.                     9,1, 12,6/*mean (0.0206815), correlation (0.386106)*/,
  106.                     -1,-9, -1,3/*mean (0.0364485), correlation (0.410752)*/,
  107.                     -13,-13, -10,5/*mean (0.0376068), correlation (0.398374)*/,
  108.                     7,7, 10,12/*mean (0.0424202), correlation (0.405663)*/,
  109.                     12,-5, 12,9/*mean (0.0942645), correlation (0.410422)*/,
  110.                     6,3, 7,11/*mean (0.1074), correlation (0.413224)*/,
  111.                     5,-13, 6,10/*mean (0.109256), correlation (0.408646)*/,
  112.                     2,-12, 2,3/*mean (0.131691), correlation (0.416076)*/,
  113.                     3,8, 4,-6/*mean (0.165081), correlation (0.417569)*/,
  114.                     2,6, 12,-13/*mean (0.171874), correlation (0.408471)*/,
  115.                     9,-12, 10,3/*mean (0.175146), correlation (0.41296)*/,
  116.                     -8,4, -7,9/*mean (0.183682), correlation (0.402956)*/,
  117.                     -11,12, -4,-6/*mean (0.184672), correlation (0.416125)*/,
  118.                     1,12, 2,-8/*mean (0.191487), correlation (0.386696)*/,
  119.                     6,-9, 7,-4/*mean (0.192668), correlation (0.394771)*/,
  120.                     2,3, 3,-2/*mean (0.200157), correlation (0.408303)*/,
  121.                     6,3, 11,0/*mean (0.204588), correlation (0.411762)*/,
  122.                     3,-3, 8,-8/*mean (0.205904), correlation (0.416294)*/,
  123.                     7,8, 9,3/*mean (0.213237), correlation (0.409306)*/,
  124.                     -11,-5, -6,-4/*mean (0.243444), correlation (0.395069)*/,
  125.                     -10,11, -5,10/*mean (0.247672), correlation (0.413392)*/,
  126.                     -5,-8, -3,12/*mean (0.24774), correlation (0.411416)*/,
  127.                     -10,5, -9,0/*mean (0.00213675), correlation (0.454003)*/,
  128.                     8,-1, 12,-6/*mean (0.0293635), correlation (0.455368)*/,
  129.                     4,-6, 6,-11/*mean (0.0404971), correlation (0.457393)*/,
  130.                     -10,12, -8,7/*mean (0.0481107), correlation (0.448364)*/,
  131.                     4,-2, 6,7/*mean (0.050641), correlation (0.455019)*/,
  132.                     -2,0, -2,12/*mean (0.0525978), correlation (0.44338)*/,
  133.                     -5,-8, -5,2/*mean (0.0629667), correlation (0.457096)*/,
  134.                     7,-6, 10,12/*mean (0.0653846), correlation (0.445623)*/,
  135.                     -9,-13, -8,-8/*mean (0.0858749), correlation (0.449789)*/,
  136.                     -5,-13, -5,-2/*mean (0.122402), correlation (0.450201)*/,
  137.                     8,-8, 9,-13/*mean (0.125416), correlation (0.453224)*/,
  138.                     -9,-11, -9,0/*mean (0.130128), correlation (0.458724)*/,
  139.                     1,-8, 1,-2/*mean (0.132467), correlation (0.440133)*/,
  140.                     7,-4, 9,1/*mean (0.132692), correlation (0.454)*/,
  141.                     -2,1, -1,-4/*mean (0.135695), correlation (0.455739)*/,
  142.                     11,-6, 12,-11/*mean (0.142904), correlation (0.446114)*/,
  143.                     -12,-9, -6,4/*mean (0.146165), correlation (0.451473)*/,
  144.                     3,7, 7,12/*mean (0.147627), correlation (0.456643)*/,
  145.                     5,5, 10,8/*mean (0.152901), correlation (0.455036)*/,
  146.                     0,-4, 2,8/*mean (0.167083), correlation (0.459315)*/,
  147.                     -9,12, -5,-13/*mean (0.173234), correlation (0.454706)*/,
  148.                     0,7, 2,12/*mean (0.18312), correlation (0.433855)*/,
  149.                     -1,2, 1,7/*mean (0.185504), correlation (0.443838)*/,
  150.                     5,11, 7,-9/*mean (0.185706), correlation (0.451123)*/,
  151.                     3,5, 6,-8/*mean (0.188968), correlation (0.455808)*/,
  152.                     -13,-4, -8,9/*mean (0.191667), correlation (0.459128)*/,
  153.                     -5,9, -3,-3/*mean (0.193196), correlation (0.458364)*/,
  154.                     -4,-7, -3,-12/*mean (0.196536), correlation (0.455782)*/,
  155.                     6,5, 8,0/*mean (0.1972), correlation (0.450481)*/,
  156.                     -7,6, -6,12/*mean (0.199438), correlation (0.458156)*/,
  157.                     -13,6, -5,-2/*mean (0.211224), correlation (0.449548)*/,
  158.                     1,-10, 3,10/*mean (0.211718), correlation (0.440606)*/,
  159.                     4,1, 8,-4/*mean (0.213034), correlation (0.443177)*/,
  160.                     -2,-2, 2,-13/*mean (0.234334), correlation (0.455304)*/,
  161.                     2,-12, 12,12/*mean (0.235684), correlation (0.443436)*/,
  162.                     -2,-13, 0,-6/*mean (0.237674), correlation (0.452525)*/,
  163.                     4,1, 9,3/*mean (0.23962), correlation (0.444824)*/,
  164.                     -6,-10, -3,-5/*mean (0.248459), correlation (0.439621)*/,
  165.                     -3,-13, -1,1/*mean (0.249505), correlation (0.456666)*/,
  166.                     7,5, 12,-11/*mean (0.00119208), correlation (0.495466)*/,
  167.                     4,-2, 5,-7/*mean (0.00372245), correlation (0.484214)*/,
  168.                     -13,9, -9,-5/*mean (0.00741116), correlation (0.499854)*/,
  169.                     7,1, 8,6/*mean (0.0208952), correlation (0.499773)*/,
  170.                     7,-8, 7,6/*mean (0.0220085), correlation (0.501609)*/,
  171.                     -7,-4, -7,1/*mean (0.0233806), correlation (0.496568)*/,
  172.                     -8,11, -7,-8/*mean (0.0236505), correlation (0.489719)*/,
  173.                     -13,6, -12,-8/*mean (0.0268781), correlation (0.503487)*/,
  174.                     2,4, 3,9/*mean (0.0323324), correlation (0.501938)*/,
  175.                     10,-5, 12,3/*mean (0.0399235), correlation (0.494029)*/,
  176.                     -6,-5, -6,7/*mean (0.0420153), correlation (0.486579)*/,
  177.                     8,-3, 9,-8/*mean (0.0548021), correlation (0.484237)*/,
  178.                     2,-12, 2,8/*mean (0.0616622), correlation (0.496642)*/,
  179.                     -11,-2, -10,3/*mean (0.0627755), correlation (0.498563)*/,
  180.                     -12,-13, -7,-9/*mean (0.0829622), correlation (0.495491)*/,
  181.                     -11,0, -10,-5/*mean (0.0843342), correlation (0.487146)*/,
  182.                     5,-3, 11,8/*mean (0.0929937), correlation (0.502315)*/,
  183.                     -2,-13, -1,12/*mean (0.113327), correlation (0.48941)*/,
  184.                     -1,-8, 0,9/*mean (0.132119), correlation (0.467268)*/,
  185.                     -13,-11, -12,-5/*mean (0.136269), correlation (0.498771)*/,
  186.                     -10,-2, -10,11/*mean (0.142173), correlation (0.498714)*/,
  187.                     -3,9, -2,-13/*mean (0.144141), correlation (0.491973)*/,
  188.                     2,-3, 3,2/*mean (0.14892), correlation (0.500782)*/,
  189.                     -9,-13, -4,0/*mean (0.150371), correlation (0.498211)*/,
  190.                     -4,6, -3,-10/*mean (0.152159), correlation (0.495547)*/,
  191.                     -4,12, -2,-7/*mean (0.156152), correlation (0.496925)*/,
  192.                     -6,-11, -4,9/*mean (0.15749), correlation (0.499222)*/,
  193.                     6,-3, 6,11/*mean (0.159211), correlation (0.503821)*/,
  194.                     -13,11, -5,5/*mean (0.162427), correlation (0.501907)*/,
  195.                     11,11, 12,6/*mean (0.16652), correlation (0.497632)*/,
  196.                     7,-5, 12,-2/*mean (0.169141), correlation (0.484474)*/,
  197.                     -1,12, 0,7/*mean (0.169456), correlation (0.495339)*/,
  198.                     -4,-8, -3,-2/*mean (0.171457), correlation (0.487251)*/,
  199.                     -7,1, -6,7/*mean (0.175), correlation (0.500024)*/,
  200.                     -13,-12, -8,-13/*mean (0.175866), correlation (0.497523)*/,
  201.                     -7,-2, -6,-8/*mean (0.178273), correlation (0.501854)*/,
  202.                     -8,5, -6,-9/*mean (0.181107), correlation (0.494888)*/,
  203.                     -5,-1, -4,5/*mean (0.190227), correlation (0.482557)*/,
  204.                     -13,7, -8,10/*mean (0.196739), correlation (0.496503)*/,
  205.                     1,5, 5,-13/*mean (0.19973), correlation (0.499759)*/,
  206.                     1,0, 10,-13/*mean (0.204465), correlation (0.49873)*/,
  207.                     9,12, 10,-1/*mean (0.209334), correlation (0.49063)*/,
  208.                     5,-8, 10,-9/*mean (0.211134), correlation (0.503011)*/,
  209.                     -1,11, 1,-13/*mean (0.212), correlation (0.499414)*/,
  210.                     -9,-3, -6,2/*mean (0.212168), correlation (0.480739)*/,
  211.                     -1,-10, 1,12/*mean (0.212731), correlation (0.502523)*/,
  212.                     -13,1, -8,-10/*mean (0.21327), correlation (0.489786)*/,
  213.                     8,-11, 10,-6/*mean (0.214159), correlation (0.488246)*/,
  214.                     2,-13, 3,-6/*mean (0.216993), correlation (0.50287)*/,
  215.                     7,-13, 12,-9/*mean (0.223639), correlation (0.470502)*/,
  216.                     -10,-10, -5,-7/*mean (0.224089), correlation (0.500852)*/,
  217.                     -10,-8, -8,-13/*mean (0.228666), correlation (0.502629)*/,
  218.                     4,-6, 8,5/*mean (0.22906), correlation (0.498305)*/,
  219.                     3,12, 8,-13/*mean (0.233378), correlation (0.503825)*/,
  220.                     -4,2, -3,-3/*mean (0.234323), correlation (0.476692)*/,
  221.                     5,-13, 10,-12/*mean (0.236392), correlation (0.475462)*/,
  222.                     4,-13, 5,-1/*mean (0.236842), correlation (0.504132)*/,
  223.                     -9,9, -4,3/*mean (0.236977), correlation (0.497739)*/,
  224.                     0,3, 3,-9/*mean (0.24314), correlation (0.499398)*/,
  225.                     -12,1, -6,1/*mean (0.243297), correlation (0.489447)*/,
  226.                     3,2, 4,-8/*mean (0.00155196), correlation (0.553496)*/,
  227.                     -10,-10, -10,9/*mean (0.00239541), correlation (0.54297)*/,
  228.                     8,-13, 12,12/*mean (0.0034413), correlation (0.544361)*/,
  229.                     -8,-12, -6,-5/*mean (0.003565), correlation (0.551225)*/,
  230.                     2,2, 3,7/*mean (0.00835583), correlation (0.55285)*/,
  231.                     10,6, 11,-8/*mean (0.00885065), correlation (0.540913)*/,
  232.                     6,8, 8,-12/*mean (0.0101552), correlation (0.551085)*/,
  233.                     -7,10, -6,5/*mean (0.0102227), correlation (0.533635)*/,
  234.                     -3,-9, -3,9/*mean (0.0110211), correlation (0.543121)*/,
  235.                     -1,-13, -1,5/*mean (0.0113473), correlation (0.550173)*/,
  236.                     -3,-7, -3,4/*mean (0.0140913), correlation (0.554774)*/,
  237.                     -8,-2, -8,3/*mean (0.017049), correlation (0.55461)*/,
  238.                     4,2, 12,12/*mean (0.01778), correlation (0.546921)*/,
  239.                     2,-5, 3,11/*mean (0.0224022), correlation (0.549667)*/,
  240.                     6,-9, 11,-13/*mean (0.029161), correlation (0.546295)*/,
  241.                     3,-1, 7,12/*mean (0.0303081), correlation (0.548599)*/,
  242.                     11,-1, 12,4/*mean (0.0355151), correlation (0.523943)*/,
  243.                     -3,0, -3,6/*mean (0.0417904), correlation (0.543395)*/,
  244.                     4,-11, 4,12/*mean (0.0487292), correlation (0.542818)*/,
  245.                     2,-4, 2,1/*mean (0.0575124), correlation (0.554888)*/,
  246.                     -10,-6, -8,1/*mean (0.0594242), correlation (0.544026)*/,
  247.                     -13,7, -11,1/*mean (0.0597391), correlation (0.550524)*/,
  248.                     -13,12, -11,-13/*mean (0.0608974), correlation (0.55383)*/,
  249.                     6,0, 11,-13/*mean (0.065126), correlation (0.552006)*/,
  250.                     0,-1, 1,4/*mean (0.074224), correlation (0.546372)*/,
  251.                     -13,3, -9,-2/*mean (0.0808592), correlation (0.554875)*/,
  252.                     -9,8, -6,-3/*mean (0.0883378), correlation (0.551178)*/,
  253.                     -13,-6, -8,-2/*mean (0.0901035), correlation (0.548446)*/,
  254.                     5,-9, 8,10/*mean (0.0949843), correlation (0.554694)*/,
  255.                     2,7, 3,-9/*mean (0.0994152), correlation (0.550979)*/,
  256.                     -1,-6, -1,-1/*mean (0.10045), correlation (0.552714)*/,
  257.                     9,5, 11,-2/*mean (0.100686), correlation (0.552594)*/,
  258.                     11,-3, 12,-8/*mean (0.101091), correlation (0.532394)*/,
  259.                     3,0, 3,5/*mean (0.101147), correlation (0.525576)*/,
  260.                     -1,4, 0,10/*mean (0.105263), correlation (0.531498)*/,
  261.                     3,-6, 4,5/*mean (0.110785), correlation (0.540491)*/,
  262.                     -13,0, -10,5/*mean (0.112798), correlation (0.536582)*/,
  263.                     5,8, 12,11/*mean (0.114181), correlation (0.555793)*/,
  264.                     8,9, 9,-6/*mean (0.117431), correlation (0.553763)*/,
  265.                     7,-4, 8,-12/*mean (0.118522), correlation (0.553452)*/,
  266.                     -10,4, -10,9/*mean (0.12094), correlation (0.554785)*/,
  267.                     7,3, 12,4/*mean (0.122582), correlation (0.555825)*/,
  268.                     9,-7, 10,-2/*mean (0.124978), correlation (0.549846)*/,
  269.                     7,0, 12,-2/*mean (0.127002), correlation (0.537452)*/,
  270.                     -1,-6, 0,-11/*mean (0.127148), correlation (0.547401)*/
  271.                 ]);
  272.  
  273.             var H = new jsfeat.matrix_t(3, 3, jsfeat.F32_t|jsfeat.C1_t);
  274.             var patch_img = new jsfeat.matrix_t(32, 32, jsfeat.U8_t|jsfeat.C1_t);
  275.  
  276.             var rectify_patch = function(src, dst, angle, px, py, psize) {
  277.                 var cosine = Math.cos(angle);
  278.                 var sine   = Math.sin(angle);
  279.  
  280.                 H.data[0] = cosine, H.data[1] = -sine,    H.data[2] = (-cosine + sine  ) * psize*0.5 + px,
  281.                 H.data[3] = sine,   H.data[4] =  cosine,  H.data[5] = (-sine   - cosine) * psize*0.5 + py;
  282.  
  283.                 jsfeat.imgproc.warp_affine(src, dst, H, 128);
  284.             }
  285.  
  286.         return {
  287.  
  288.                 describe: function(src, corners, count, descriptors) {
  289.                         var DESCR_SIZE = 32; // bytes;
  290.                                 var i=0,b=0,px=0.0,py=0.0,angle=0.0;
  291.                                 var t0=0, t1=0, val=0;
  292.                                 var img = src.data, w = src.cols, h = src.rows;
  293.                                 var patch_d = patch_img.data;
  294.                                 var patch_off = 16*32 + 16; // center of patch
  295.                                 var patt=0;
  296.  
  297.                                 if(!(descriptors.type&jsfeat.U8_t)) {
  298.                                         // relocate to U8 type
  299.                                         descriptors.type = jsfeat.U8_t;
  300.                                         descriptors.cols = DESCR_SIZE;
  301.                         descriptors.rows = count;
  302.                         descriptors.channel = 1;
  303.                                         descriptors.allocate();
  304.                                 } else {
  305.                                         descriptors.resize(DESCR_SIZE, count, 1);
  306.                                 }
  307.  
  308.                                 var descr_d = descriptors.data;
  309.                                 var descr_off = 0;
  310.  
  311.                                 for(i = 0; i < count; ++i) {
  312.                                         px = corners[i].x;
  313.                                         py = corners[i].y;
  314.                                         angle = corners[i].angle;
  315.  
  316.                                         rectify_patch(src, patch_img, angle, px, py, 32);
  317.  
  318.                                         // describe the patch
  319.                                         patt = 0;
  320.                                         for (b = 0; b < DESCR_SIZE; ++b) {
  321.                                    
  322.                                     t0 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  323.                                     t1 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  324.                                     val = (t0 < t1)|0;
  325.                                    
  326.                                     t0 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  327.                                     t1 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  328.                                     val |= (t0 < t1) << 1;
  329.                                    
  330.                                     t0 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  331.                                     t1 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  332.                                     val |= (t0 < t1) << 2;
  333.                                    
  334.                                     t0 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  335.                                     t1 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  336.                                     val |= (t0 < t1) << 3;
  337.                                    
  338.                                     t0 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  339.                                     t1 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  340.                                     val |= (t0 < t1) << 4;
  341.                                    
  342.                                     t0 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  343.                                     t1 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  344.                                     val |= (t0 < t1) << 5;
  345.                                    
  346.                                     t0 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  347.                                     t1 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  348.                                     val |= (t0 < t1) << 6;
  349.                                    
  350.                                     t0 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  351.                                     t1 = patch_d[patch_off + bit_pattern_31_[patt+1] * 32 + bit_pattern_31_[patt]]; patt += 2
  352.                                     val |= (t0 < t1) << 7;
  353.                                    
  354.                                     descr_d[descr_off+b] = val;
  355.                                 }
  356.                                 descr_off += DESCR_SIZE;
  357.                                 }
  358.                 }
  359.         };
  360.     })();
  361.  
  362.     global.orb = orb;
  363.  
  364. })(jsfeat);
  365.  
downloadjsfeat_orb.js Source code - Download jsfeat Source code
Related Source Codes/Software:
flakes - Flakes is an Admin Template Framework. A combinati... 2017-04-15
capstone - Capstone disassembly/disassembler framework: Core ... 2017-04-15
nginx-resources - A collection of resources covering Nginx, Nginx + ... 2017-04-15
utron - A lightweight MVC framework for Go(Golang) 2017-04-15
cfssl - CFSSL: Cloudflare's PKI and TLS toolkit ... 2017-04-15
MLeaksFinder - Find memory leaks in your iOS app at develop time. 2017-04-16
qt - Qt binding for Go (Golang) which supports Windows ... 2017-04-16
rainloop-webmail - Simple, modern & fast web-based email client ... 2017-04-16
pencil - Multiplatform GUI Prototyping/Wireframing 2017-04-16
x64dbg - An open-source x64/x32 debugger for windows. ... 2017-04-16
Toucan - Fabulous Image Processing in Swift 2017-04-23
CoffeeScriptRedux - 2017-04-23
breakpoint - Really simple media queries in Sa 2017-04-23
libsvm - 2017-04-22
grr - GRR Rapid Response: remote live forensics for inci... 2017-04-22
grit - **Grit is no longer maintained. Check out libgit2/... 2017-04-22
guard-livereload - Guard::LiveReload automatically reload your browse... 2017-04-22
Begin-Latex-in-minutes - Brief Intro to LaTeX for beginners that helps you ... 2017-04-22
wicked - Use wicked to turn your controller into a wizard ... 2017-04-22
flexboxfroggy - A game for learning CSS flexbox ... 2017-04-22

 Back to top