ezsift.js
v1.0.0
Published
ezSIFT (open source SIFT algorithm) ported from C via Emscripten
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) -> imgto create a 8bit imageModule._disposeImage(img)to release memory allocModule._putPixel(img, x, y, val), where 0 <= val < 256Module._getPixel(img, x, y) -> valModule._extractFeature(img)to extract feature into an internal listrKeypointsModule._backupKeypoints(index), where 0 <= index < 10, to save current internalrKeypointsinto a cell at index.Module._restoreKeypoints(index), to load the saved list assigning to internalrKeypointsModule._getKeypointsN()to get current the number of key points inrKeypointsModule._keypointBegin()to assign the first key point to cursor inrKeypointsModule._keypointNext()to get next key point inrKeypointsModule._keypointHasNext()to check if has next key pointModule._keypointOctave()_keypointLayer()_keypointR()_keypointC()_keypointScale()_keypointOri()_keypointDescriptor(index), where 0 <= index < 128to 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 listrMatchModule._getMatchN()to get the number of matched key points inrMatchModule._matchBegin()to assign the first matched key point to cursor inrMatchModule._matchNext()to get next matched key point inrMatchModule._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,crepresentsxmeanwhilerrepresentsyin real image
after get ezsift.js,
- put into
distfolder; - create a folder
localand put1.png2.pnginto the folder; - run
python -m SimpleHTTPServerorpython3 -m http.server - open
http://127.0.0.1:8000/test.html(canvasContext.getImageData()do not work when directly opentest.htmlin file protocol due to cross-origin)
wait for seconds, you will see a canvas drawing matched points between 2 images.
