-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automated image matching and stitching using matcher-core library #312
base: main
Are you sure you want to change the base?
Changes from all commits
45ffdee
0f17e8a
7613b51
afdf20d
04c9411
639c25d
64522b5
d57a770
60f18ca
71f91e3
db66c54
518e7d7
c183696
d4ce53a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
node_modules | ||
coverage | ||
todo.txt | ||
*.swp | ||
*.swo | ||
package-lock.json | ||
bower_components | ||
.vscode | ||
node_modules |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,121 +1,118 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Leaflet.DistortableImage Example</title> | ||
<meta charset="utf-8" /> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<head> | ||
<title>Leaflet.DistortableImage Example</title> | ||
<meta charset="utf-8" /> | ||
|
||
<script | ||
src="../node_modules/leaflet/dist/leaflet.js" | ||
type="text/javascript" | ||
charset="utf-8" | ||
></script> | ||
<link | ||
href="../node_modules/font-awesome/css/font-awesome.min.css" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="../node_modules/leaflet/dist/leaflet.css" | ||
type="text/css" | ||
media="screen" | ||
title="no title" | ||
charset="utf-8" | ||
/> | ||
<script src="../node_modules/leaflet-toolbar/dist/leaflet.toolbar.js"></script> | ||
<link | ||
href="../node_modules/leaflet-toolbar/dist/leaflet.toolbar.css" | ||
rel="stylesheet" | ||
/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
|
||
<!-- for full-res export --> | ||
<script src="../node_modules/jquery/dist/jquery.js"></script> | ||
<script src="../node_modules/webgl-distort/dist/webgl-distort.js"></script> | ||
<script src="../node_modules/glfx/glfx.js"></script> | ||
<script src="../node_modules/leaflet/dist/leaflet.js" type="text/javascript" charset="utf-8"></script> | ||
<link href="../node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet" /> | ||
<link rel="stylesheet" href="../node_modules/leaflet/dist/leaflet.css" type="text/css" media="screen" title="no title" | ||
charset="utf-8" /> | ||
<script src="../node_modules/leaflet-toolbar/dist/leaflet.toolbar.js"></script> | ||
<link href="../node_modules/leaflet-toolbar/dist/leaflet.toolbar.css" rel="stylesheet" /> | ||
<!-- for pattern-mining utility --> | ||
<script src="../node_modules/matcher-core/orb.core.com.js"></script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we ought to move this to a unique example file called "matcher"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rexagod i think we'd better follow up on this, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good, on it! 👍 |
||
<script src="../src/util/matcher/init_with_matcher.js"></script> | ||
<script src="../src/util/matcher/projector.js"></script> | ||
<script src="../src/util/matcher/stitcher.js"></script> | ||
<script src="../src/util/matcher/init_.js"></script> | ||
<!-- for full-res export --> | ||
<script src="../node_modules/jquery/dist/jquery.js"></script> | ||
<script src="../node_modules/webgl-distort/dist/webgl-distort.js"></script> | ||
<script src="../node_modules/glfx/glfx.js"></script> | ||
|
||
<!-- for EXIF geocode --> | ||
<script | ||
type="text/javascript" | ||
src="../node_modules/exif-js/exif.js" | ||
></script> | ||
<!-- for EXIF geocode --> | ||
<script type="text/javascript" src="../node_modules/exif-js/exif.js"></script> | ||
|
||
<link | ||
rel="stylesheet" | ||
href="../dist/leaflet.distortableimage.css" | ||
type="text/css" | ||
media="screen" | ||
title="no title" | ||
charset="utf-8" | ||
/> | ||
<script src="../dist/leaflet.distortableimage.js"></script> | ||
</head> | ||
<body style="margin:0;"> | ||
<form id="test_form"> | ||
<input type="file" id="inputimage" accept="image/*" /> | ||
</form> | ||
<link rel="stylesheet" href="../dist/leaflet.distortableimage.css" type="text/css" media="screen" title="no title" | ||
charset="utf-8" /> | ||
<script src="../dist/leaflet.distortableimage.js"></script> | ||
</head> | ||
|
||
<div | ||
id="map" | ||
style="width:100%; height:100%; position:absolute; top:0;" | ||
></div> | ||
</body> | ||
<script> | ||
var map; | ||
<body> | ||
<center> | ||
<div class="loader-container"> | ||
<img width="100" src="leaflet.gif"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, what is happening while this is showing? The matcher is searching for interest points in some images? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup! But now with the caching implemented, I guess we won't be needing this at all from the second iteration onwards, and the initial iteration should take way lesser loading time (~7000 to ~15 frames perf improvement), so I guess it would be better if we should synchronously process those, and remove this loading screen altogether? |
||
</div> | ||
</center> | ||
<form id="test_form"> | ||
<input type="file" id="inputimage" accept="image/*" /> | ||
</form> | ||
<div id="map" style="width:100%; height:100%; position:absolute; top:0;"></div> | ||
<button id="matcher-button">Toggle matcher.js</button> | ||
</body> | ||
|
||
(function() { | ||
// basic Leaflet map setup | ||
map = L.map("map").setView([51.505, -0.09], 13); | ||
L.tileLayer( | ||
"https://{s}.tiles.mapbox.com/v3/anishshah101.ipm9j6em/{z}/{x}/{y}.png", | ||
{ | ||
maxZoom: 18, | ||
attribution: | ||
'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + | ||
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + | ||
'Imagery © <a href="http://mapbox.com">Mapbox</a>', | ||
id: "examples.map-i86knfo3" | ||
} | ||
).addTo(map); | ||
<script> | ||
|
||
// create an image | ||
img = L.distortableImageOverlay("example.png", { | ||
// (WIP) add a toolbarType field with values 'popup' (default) or 'control' | ||
// add a keymapper: false <== hides the keymapper | ||
// add a keymapper_position field with combinations of 'top', 'bottom', 'left' or 'right' | ||
// mode: "distort", => default handle | ||
selected: true, | ||
corners: [ | ||
L.latLng(51.52, -0.1), | ||
L.latLng(51.52, -0.14), | ||
L.latLng(51.5, -0.1), | ||
L.latLng(51.5, -0.14) | ||
], | ||
fullResolutionSrc: "large.jpg" | ||
}).addTo(map); | ||
paths = ['../node_modules/matcher-core/assets/resources/big.jpg', '../node_modules/matcher-core/assets/resources/small.jpg']; | ||
|
||
/* add custom icon functionality */ | ||
// refer this snippet below inorder to add a custom functionality | ||
function add() { | ||
var map = L.map("map").setView([51.505, -0.09], 12); | ||
L.tileLayer( | ||
"https://{s}.tiles.mapbox.com/v3/anishshah101.ipm9j6em/{z}/{x}/{y}.png", | ||
{ | ||
maxZoom: 18, | ||
id: "examples.map-i86knfo3" | ||
} | ||
).addTo(map); | ||
|
||
// var tool = EditOverlayAction.extend({ | ||
// options: { | ||
// toolbarIcon: { | ||
// html: '<span class="fa fa-plus-circle"></span>', | ||
// tooltip: "Print a console message!", | ||
// title: "Console logger" | ||
// } | ||
// }, | ||
// | ||
// addHooks: function() { | ||
// var editing = this._overlay.editing; | ||
// editing._demonstrator(); | ||
// this.disable(); | ||
// } | ||
// }); | ||
// | ||
// img._addTool(tool); | ||
var img1 = L.distortableImageOverlay(paths[0], { | ||
selected: true, | ||
corners: [ | ||
L.latLng(51.52, -0.1), | ||
L.latLng(51.52, -0.14), | ||
L.latLng(51.5, -0.1), | ||
L.latLng(51.5, -0.14) | ||
], | ||
fullResolutionSrc: "large.jpg" | ||
}).addTo(map); | ||
|
||
var img2 = L.distortableImageOverlay(paths[1], { | ||
selected: true, | ||
corners: [ | ||
L.latLng(51.52, -0.14), | ||
L.latLng(51.52, -0.18), | ||
L.latLng(51.5, -0.14), | ||
L.latLng(51.5, -0.18) | ||
], | ||
fullResolutionSrc: "large.jpg" | ||
}).addTo(map); | ||
var L_img_array = [img1, img2]; | ||
for (var y = 0; y < L_img_array.length; y++) { | ||
L.DomEvent.on(L_img_array[y]._image, "load", L_img_array[y].editing.enable, L_img_array[y].editing); | ||
} | ||
return { L_img_array: L_img_array, map: map }; | ||
} | ||
|
||
(function start() { | ||
if (sessionStorage.getItem('flag')==='true') { | ||
init_with_matcher(add, paths); | ||
} else { | ||
sessionStorage.setItem('flag', 'false'); | ||
init_(add); | ||
} | ||
})(); | ||
|
||
document.getElementById('matcher-button').addEventListener('click', setter); | ||
document.getElementById('matcher-button').addEventListener('mouseover', function(e) { | ||
if(sessionStorage.getItem('flag')==='true') { | ||
e.target.innerHTML = "current state: running"; | ||
} else { | ||
e.target.innerHTML = "current state: not initialized"; | ||
} | ||
}); | ||
document.getElementById('matcher-button').addEventListener('mouseleave', function(e) { | ||
e.target.innerHTML = "Toggle matcher.js"; | ||
}); | ||
|
||
function setter() { | ||
sessionStorage.setItem('flag', (sessionStorage.getItem('flag')==='true'?'false':'true')); | ||
location.reload(); | ||
} | ||
|
||
</script> | ||
|
||
L.DomEvent.on(img._image, "load", img.editing.enable, img.editing); | ||
})(); | ||
</script> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have started using more specific css selectors in our library so they don't overwrite anything downstream. see #330