2. Alberto
Software Developer &
Linux Sysadmin
C/C++ ( since 80’s :/ )
GWT ( since 1.6 )
Javascript & Java
alberto@jooink.com
+AlbertoMancini
3. Francesca
Web and mobile developer,
software engineer and
architect
C/C++, CFD, HPC
GWT since 2009
“with a passion for clean code and
fine tuned details”
francesca@jooink.com
@francescatosi
+FrancescaTosi
4. Devfest’s CodeProject
A couple of years(**)
ago we started working on a
pet project trying to explore how mixing modern
WebAPIs and an effective programming approach(*)
can enable us to develop complex client-side
applications running in a browser.
(*)
read: GWT, i.e. a typed language compiled into js
(**)
for the 2012’s GDG DevFest season
7. I Mean ...
C’mon we are in 2015:
browsers are certainly
more than enough
for any kind of application !
GoogleDocs, Inbox, Plus, Scala vm in js, JsDOSBox…
8. BETting
The right tool(*)
is enough to let us to
develop
- complex
- compute-intensive
browser-based applications ?
(*)
GWT of course :)
9. The RIGHT TOOL
Should (at least) let us:
● master the (quite tricky) web platform
● code safely … in a type-safe language
(but provide native-like flexibility and performance)
● reuse existing code
… and of course produce a fast and reliable application
11. Target
We were working on Augmented Reality and we had an
expertize on it so we started trying to realize an
AR webApp in order to show that this kind of
applications is way too-complex for the performance
of a browser.
13. Marker Based AR
Essentially composed of 3 steps
● Marker detection and identification
(finding the marker in a picture)
● Computation of the marker pose
(det. six degrees of freedom w.r.t camera, f.i.)
● Syntetic objects collocation
(object space to camera space transf)
15. NyARToolkit, do not reinvent the wheel
NyARToolKit
is an ARToolKit
built with
100% pure Java.
[great
performance,
featurefull, GPL]
http://nyatla.jp/nyartoolkit/wp/
16. GWT-NyARToolkit
… given an image we get a 3x4 (3x3 + a
translation vector actually) matrix that
identifies the marker in the camera space
nyar.update(i_sensor); ← ‘push’ an image
found = nyar.isExistMarker(marker_id); ← query if a marker is detected
mm = nyar.getMarkerMatrix(marker_id); ← compute the collocation matrix
https://code.google.com/p/gwt-nyartoolkit/
http://jooink.blogspot.com
25. WebRTC with GWT
GWT (Elemental at the beginning)
At the beginning elemental, but right now (using
jnsi and now jsinterop) we are able to do all the
operation without dependencies GWT.
https://code.google.com/p/elemental-getusermedia-demo
https://github.com/jooink/gwt-getusermedia
26. Browser Based AR
<video/>
the video stream
can (has to be) be played in a <video/> tag
“native” (jsni)
video.src = URL.createObjectURL(stream);
32. WebGL
We had to reinvent the wheel :(
three.js, BabylonJS
parallax (GWT !)
awesome shading rendering and lighting
tend to mix webgl-interaction with 3D graphics
44. Computer Vision
Computer Vision
As told by Alberto, after a while we needed to have
some more complex features on this tool for image
recognition, in order to have more information on
the image we are working with.
46. Computer Vision
Computer Vision
There exists a lot of CV libs (complete, tested and
fine tuned) for example:
- OpenCV
- VLFeat
- VLX
- …
- BoofCV
C/C++
Java
47. Computer Vision
Computer Vision by BoofCV
There is a great library for Computer Vision
interely written in Pure Java: BoofCV → we decided
to adapt BoofCV for GWT.
48. BoofCV
BoofCV is a complete & complex project
BoofCV is an opensource Java library for computer
vision & robotics applications.
BoofCV is organized into several packages:
image processing, features, geometric vision, calibration,
recognition, visualize and IO.
49. BoofCV
Written by Peter Abeles
www.boofcv.org
Link to the source code:
https://github.com/lessthanoptimal/BoofCV
50. BoofCV
Adapting an entire big & complex
library is not is a funny game.
BoofCV depends on other Java libs, so we must adapt
all the dependencies
51. BoofCV
- DDogLeg: Java numerical lib for
non-linear optimization, robust
model-fitting, polynomial root
finding, sorting and more;
- GeoRegression: open source java
geometry lib for scientific
computing;
- EJML: dense matrix linear
algebra library written in Java
53. EJML
- EJML:
dense matrix linear algebra library written in
Java
https://github.com/lessthanoptimal/ejml
54. GWT-EJML
GWT-EJML
is an adapter-project around EJML that let us to use
the original library:
- provides .gwt.xml files
- supersources many classes
- contains running examples
57. GWT-EJML
.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.7.0
//EN"
"http://gwtproject.org/doctype/2.7.0/gwt-module.dtd">
<module rename-to='gwtejml'>
<inherits name='org.EJML'/>
...
<super-source path="jre" />
...
</module>
58. GWT-EJML
The Strategy
we decided to use the SuperSourcing in order to
change/adapt the class of the basic lib and leave
the ejml project unchanged
→ the maintainability is easier
59. GWT-EJML
SuperSourcing
We added the super source path in the gwt.xml config
file
<super-source path="jre" />
and we created the file to modify in that directory
(using the right path of the file in the main
project).
60. GWT-EJML
.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.7.0
//EN"
"http://gwtproject.org/doctype/2.7.0/gwt-module.dtd">
<module rename-to='gwtejml'>
<inherits name='org.EJML'/>
...
<super-source path="jre" />
...
</module>
61. GWT-EJML
Supersourced parts of JRE
java.io.ByteArrayOutputStream
public class ByteArrayOutputStream extends OutputStream {
public ByteArrayOutputStream() { … }
public void write(int arg0) { … }
}
62. GWT-EJML
Supersourced parts of EJML
org.ejml.ops.MatrixIO;
public class MatrixIO { … }
org.ejml.alg.dense.decomposition
.eig.symm.SymmetricQREigenHelper
org.ejml.alg.dense.decomposition
.svd.implicitqr.SvdImplicitQrAlgorithm
java.io.
PrintStream
printf()
63. GWT-EJML
Supersourced parts of EJML
java.io.PrintStream does not have printf() in the
gwt emulated jre
We could not supersource the PrintStream because
already exist on emulated jre and we cannot super-
sourcing just a method.
77. BoofCV
GWT-BOOFCV:
● Reflection:
○ used mostly to handle Arrays of primitive
types
○ probably unneeded upstream
working with Peter to understand if can be
avoided through, for instance, a few of
factories.
● Image managment
80. BoofCV
Image managment:
of course we had to work-out the different point of
view about Images:
Browser → (<img/> <video/>)
BoofCV → array of values
→ we used <canvas/> (also in this case);
canvas.getContext2d().getImageData( … );
85. Questions? Contact us :
Francesca Tosi
R&D at Jooink Team
francesca@jooink.com
Alberto Mancini
Dev at Jooink Team
alberto@jooink.com
Thanks !
Please rate this presentation http://gwtcreate.com/agenda