BVB Source Codes

jsfeat Show jsfeat_yape06.js Source code

Return Download jsfeat: download jsfeat_yape06.js Source code - Download jsfeat Source code - Type:.js
  1. /**
  2.  * @author Eugene Zatepyakin / http://inspirit.ru/
  3.  *
  4.  * Copyright 2007 Computer Vision Lab,
  5.  * Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland.
  6.  * @author Vincent Lepetit (http://cvlab.epfl.ch/~lepetit)
  7.  */
  8.  
  9. (function(global) {
  10.     "use strict";
  11.     //
  12.  
  13.     var yape06 = (function() {
  14.        
  15.         var compute_laplacian = function(src, dst, w, h, Dxx, Dyy, sx,sy, ex,ey) {
  16.             var y=0,x=0,yrow=(sy*w+sx)|0,row=yrow;
  17.  
  18.             for(y = sy; y < ey; ++y, yrow+=w, row = yrow) {
  19.                 for(x = sx; x < ex; ++x, ++row) {
  20.                     dst[row] = -4 * src[row] + src[row+Dxx] + src[row-Dxx] + src[row+Dyy] + src[row-Dyy];
  21.                 }
  22.             }
  23.         }
  24.  
  25.         var hessian_min_eigen_value = function(src, off, tr, Dxx, Dyy, Dxy, Dyx) {
  26.             var Ixx = -2 * src[off] + src[off + Dxx] + src[off - Dxx];
  27.             var Iyy = -2 * src[off] + src[off + Dyy] + src[off - Dyy];
  28.             var Ixy = src[off + Dxy] + src[off - Dxy] - src[off + Dyx] - src[off - Dyx];
  29.             var sqrt_delta = ( Math.sqrt(((Ixx - Iyy) * (Ixx - Iyy) + 4 * Ixy * Ixy) ) )|0;
  30.  
  31.             return Math.min(Math.abs(tr - sqrt_delta), Math.abs(-(tr + sqrt_delta)));
  32.         }
  33.  
  34.         return {
  35.  
  36.             laplacian_threshold: 30,
  37.             min_eigen_value_threshold: 25,
  38.  
  39.             detect: function(src, points, border) {
  40.                 if (typeof border === "undefined") { border = 5; }
  41.                 var x=0,y=0;
  42.                 var w=src.cols, h=src.rows, srd_d=src.data;
  43.                 var Dxx = 5, Dyy = (5 * w)|0;
  44.                 var Dxy = (3 + 3 * w)|0, Dyx = (3 - 3 * w)|0;
  45.                 var lap_buf = jsfeat.cache.get_buffer((w*h)<<2);
  46.                 var laplacian = lap_buf.i32;
  47.                 var lv=0, row=0,rowx=0,min_eigen_value=0,pt;
  48.                 var number_of_points = 0;
  49.                 var lap_thresh = this.laplacian_threshold;
  50.                 var eigen_thresh = this.min_eigen_value_threshold;
  51.  
  52.                 var sx = Math.max(5, border)|0;
  53.                 var sy = Math.max(3, border)|0;
  54.                 var ex = Math.min(w-5, w-border)|0;
  55.                 var ey = Math.min(h-3, h-border)|0;
  56.  
  57.                 x = w*h;
  58.                 while(--x>=0) {laplacian[x]=0;}
  59.                 compute_laplacian(srd_d, laplacian, w, h, Dxx, Dyy, sx,sy, ex,ey);
  60.  
  61.                 row = (sy*w+sx)|0;
  62.                 for(y = sy; y < ey; ++y, row += w) {
  63.                     for(x = sx, rowx=row; x < ex; ++x, ++rowx) {
  64.  
  65.                         lv = laplacian[rowx];
  66.                         if ((lv < -lap_thresh &&
  67.                             lv < laplacian[rowx - 1]      && lv < laplacian[rowx + 1] &&
  68.                             lv < laplacian[rowx - w]     && lv < laplacian[rowx + w] &&
  69.                             lv < laplacian[rowx - w - 1] && lv < laplacian[rowx + w - 1] &&
  70.                             lv < laplacian[rowx - w + 1] && lv < laplacian[rowx + w + 1])
  71.                             ||
  72.                             (lv > lap_thresh &&
  73.                             lv > laplacian[rowx - 1]      && lv > laplacian[rowx + 1] &&
  74.                             lv > laplacian[rowx - w]     && lv > laplacian[rowx + w] &&
  75.                             lv > laplacian[rowx - w - 1] && lv > laplacian[rowx + w - 1] &&
  76.                             lv > laplacian[rowx - w + 1] && lv > laplacian[rowx + w + 1])
  77.                             ) {
  78.  
  79.                             min_eigen_value = hessian_min_eigen_value(srd_d, rowx, lv, Dxx, Dyy, Dxy, Dyx);
  80.                             if (min_eigen_value > eigen_thresh) {
  81.                                 pt = points[number_of_points];
  82.                                 pt.x = x, pt.y = y, pt.score = min_eigen_value;
  83.                                 ++number_of_points;
  84.                                 ++x, ++rowx; // skip next pixel since this is maxima in 3x3
  85.                             }
  86.                         }
  87.                     }
  88.                 }
  89.  
  90.                 jsfeat.cache.put_buffer(lap_buf);
  91.  
  92.                 return number_of_points;
  93.             }
  94.  
  95.         };
  96.     })();
  97.  
  98.     global.yape06 = yape06;
  99.  
  100. })(jsfeat);
  101.  
downloadjsfeat_yape06.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