ezsift.js
v1.0.0
Published
ezSIFT (open source SIFT algorithm) ported from C via Emscripten
Downloads
1
Readme
panorama
use ezSIFT to glue photos together
port ezSIFT to javascript with emscripten
build_ezsift_with_em.sh
is used to generate ezsift.js
ezsift.cpp
is main source file for ezsift.js
to export APIs from ezSIFT
(much code copied from feature_extract.cpp
and image_match.cpp
)
Currently we support APIs:
Module._createImage(w, h) -> img
to create a 8bit imageModule._disposeImage(img)
to release memory allocModule._putPixel(img, x, y, val)
, where 0 <= val < 256Module._getPixel(img, x, y) -> val
Module._extractFeature(img)
to extract feature into an internal listrKeypoints
Module._backupKeypoints(index)
, where 0 <= index < 10, to save current internalrKeypoints
into a cell at index.Module._restoreKeypoints(index)
, to load the saved list assigning to internalrKeypoints
Module._getKeypointsN()
to get current the number of key points inrKeypoints
Module._keypointBegin()
to assign the first key point to cursor inrKeypoints
Module._keypointNext()
to get next key point inrKeypoints
Module._keypointHasNext()
to check if has next key pointModule._keypointOctave()
_keypointLayer()
_keypointR()
_keypointC()
_keypointScale()
_keypointOri()
_keypointDescriptor(index), where 0 <= index < 128
to get different key point attributesModule._keypointsMatch(indexA, indexB)
, where 0 <= indexA, indexB < 10, to match to saved key point list in 2 cells; save to internal listrMatch
Module._getMatchN()
to get the number of matched key points inrMatch
Module._matchBegin()
to assign the first matched key point to cursor inrMatch
Module._matchNext()
to get next matched key point inrMatch
Module._matchHasNext()
to check if has next matched key pointModule._matchR1()
_matchC1()
_matchR2()
_matchC2()
to get matched key point position(c1, r1) -> (c2, r2)
; in ezSIFT,c
representsx
meanwhiler
representsy
in real image
after get ezsift.js
,
- put into
dist
folder; - create a folder
local
and put1.png
2.png
into the folder; - run
python -m SimpleHTTPServer
orpython3 -m http.server
- open
http://127.0.0.1:8000/test.html
(canvasContext.getImageData()
do not work when directly opentest.html
in file protocol due to cross-origin)
wait for seconds, you will see a canvas drawing matched points between 2 images.