Skip to content
Permalink
Browse files

rebase/merge commit to combine changes from luca for mesa/linux/eclip…

…se and tobi's and Min's fixes to AVI writing and rosbag reading
  • Loading branch information...
Tobi Delbruck Tobi Delbruck
Tobi Delbruck authored and Tobi Delbruck committed Apr 17, 2018
1 parent 81f3d73 commit 7e094ec9746c70861c483585d8a7fda54a346f6a
@@ -1,71 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="subprojects/JSpikeStack/src"/>
<classpathentry kind="lib" path="jars/javacv/javacpp.jar" sourcepath="jars/javacv/org.bytedeco.javacpp-src-1.1.zip"/>
<classpathentry kind="lib" path="jars/javacv/javacv.jar"/>
<classpathentry kind="lib" path="jars/swing-layout-1.0.4.jar"/>
<classpathentry kind="lib" path="jars/UsbIoJava.jar"/>
<classpathentry kind="lib" path="jars/commons-net-3.6.jar">
<attributes>
<attribute name="javadoc_location" value="http://commons.apache.org/proper/commons-net/apidocs/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="jars/jogl/gluegen-rt.jar"/>
<classpathentry kind="lib" path="jars/jogl/jogl-all.jar">
<attributes>
<attribute name="javadoc_location" value="http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="jars/svgSalamander-tiny-2013-07-13.jar"/>
<classpathentry kind="lib" path="jars/phidget21-2.1.8.20130618.jar"/>
<classpathentry kind="lib" path="jars/javax.mail-1.5.0.jar"/>
<classpathentry kind="lib" path="jars/jlfgr-1.0.jar"/>
<classpathentry kind="lib" path="subprojects/JSpikeStack/jars/jcommon-1.0.18.jar">
<attributes>
<attribute name="javadoc_location" value="http://www.jfree.org/jcommon/api/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="subprojects/JSpikeStack/jars/jfreechart-1.0.15-experimental.jar">
<attributes>
<attribute name="javadoc_location" value="http://www.jfree.org/jfreechart/api/javadoc/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="subprojects/JSpikeStack/jars/jfreechart-1.0.15.jar">
<attributes>
<attribute name="javadoc_location" value="http://www.jfree.org/jfreechart/api/javadoc/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="jars/comm.jar"/>
<classpathentry kind="lib" path="jars/betterbeansbinding-1.3.0-all.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="jars/jblas-1.2.4.jar"/>
<classpathentry kind="lib" path="jars/JEvtLearn.jar"/>
<classpathentry kind="lib" path="jars/uncommons-maths-1.2.3.jar"/>
<classpathentry kind="lib" path="jars/USBTransferThread-0.9.6.jar"/>
<classpathentry kind="lib" path="jars/usb4java/libusb4java-1.2.0-linux-arm.jar"/>
<classpathentry kind="lib" path="jars/usb4java/libusb4java-1.2.0-linux-x86_64.jar"/>
<classpathentry kind="lib" path="jars/usb4java/libusb4java-1.2.0-linux-x86.jar"/>
<classpathentry kind="lib" path="jars/usb4java/libusb4java-1.2.0-osx-x86_64.jar"/>
<classpathentry kind="lib" path="jars/usb4java/libusb4java-1.2.0-osx-x86.jar"/>
<classpathentry kind="lib" path="jars/usb4java/libusb4java-1.2.0-windows-x86_64.jar"/>
<classpathentry kind="lib" path="jars/usb4java/libusb4java-1.2.0-windows-x86.jar"/>
<classpathentry kind="lib" path="jars/usb4java/usb4java-1.2.0.jar"/>
<classpathentry kind="lib" path="jars/commons-lang3-3.5.jar"/>
<classpathentry kind="lib" path="jars/nrjavaserial-3.12.0.jar"/>
<classpathentry kind="lib" path="jars/javacv/opencv-linux-x86_64.jar"/>
<classpathentry kind="lib" path="jars/javacv/opencv-linux-x86.jar"/>
<classpathentry kind="lib" path="jars/javacv/opencv-macosx-x86_64.jar"/>
<classpathentry kind="lib" path="jars/javacv/opencv-windows-x86_64.jar"/>
<classpathentry kind="lib" path="jars/javacv/opencv-windows-x86.jar"/>
<classpathentry kind="lib" path="jars/javacv/opencv.jar" sourcepath="jars/javacv/org.bytedeco.javacpp-opencv-core-src-1.1.zip"/>
<classpathentry kind="lib" path="jars/openni2/org.openni.jar"/>
<classpathentry kind="lib" path="jars/opencv/opencv-320.jar"/>
<classpathentry kind="lib" path="jars/jmatio.jar"/>
<classpathentry kind="lib" path="jars/gson-2.8.0.jar"/>
<classpathentry kind="lib" path="jars/matlabcontrol-4.1.0.jar"/>
<classpathentry kind="lib" path="jars/commons-math3-3.6.1.jar"/>
<classpathentry kind="lib" path="jars/sis-jhdf5/lib/batteries_included/sis-jhdf5-batteries_included.jar"/>
<classpathentry kind="lib" path="jars/libtensorflow-1.4.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="subprojects/JSpikeStack/src"/>
<classpathentry kind="lib" path="jars/UsbIoJava.jar"/>
<classpathentry kind="lib" path="subprojects/JSpikeStack/jars/jcommon-1.0.18.jar">
<attributes>
<attribute name="javadoc_location" value="http://www.jfree.org/jcommon/api/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="subprojects/JSpikeStack/jars/jfreechart-1.0.15-experimental.jar">
<attributes>
<attribute name="javadoc_location" value="http://www.jfree.org/jfreechart/api/javadoc/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="subprojects/JSpikeStack/jars/jfreechart-1.0.15.jar">
<attributes>
<attribute name="javadoc_location" value="http://www.jfree.org/jfreechart/api/javadoc/"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="jars/USBTransferThread-0.9.6.jar"/>
<classpathentry kind="lib" path="jars/openni2/org.openni.jar"/>
<classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?project=jAER_1.5&amp;ivyXmlPath=ivy.xml&amp;confs=*&amp;ivySettingsPath=ivysettings.xml&amp;loadSettingsOnDemand=false&amp;ivyUserDir=&amp;propertyFiles="/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -13,5 +13,6 @@
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.apache.ivyde.eclipse.ivynature</nature>
</natures>
</projectDescription>
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.apache.ivyde.eclipse.standaloneretrieve=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><setuplist/>
@@ -1,11 +1,15 @@
#!/bin/sh

# If you get "UnsatisfiedLinkError: /tmp/usb4java... failed to map segment from shared object: Operation not permitted",
# add the following line to the command below:
# -Djava.io.tmpdir=~/tmpdir/

java \
-classpath "dist/jAER.jar:jars/*:jars/javacv/*:jars/jogl/*:jars/usb4java/*:lib/*" \
-splash:SplashScreen.gif \
-Djava.util.logging.config.file=conf/Logging.properties -Dsun.java2d.noddraw=true -Dsun.java2d.opengl=false \
net.sf.jaer.JAERViewer
#!/bin/sh

# If you get "UnsatisfiedLinkError: /tmp/usb4java... failed to map segment from shared object: Operation not permitted",
# add the following line to the command below:
# -Djava.io.tmpdir=~/tmpdir/

# If you're using AMD graphics cards on Linux with the latest open-source Mesa drivers, you might get an
# error about not finding a supported OpenGL profile, to fix please change the classpath line below to:
# -classpath "dist/jAER.jar:jars/*:jars/jogl_mesa_amd_fix/*:lib/*" \

java \
-classpath "dist/jAER.jar:jars/*:lib/*" \
-splash:SplashScreen.gif \
-Djava.util.logging.config.file=conf/Logging.properties -Dsun.java2d.noddraw=true -Dsun.java2d.opengl=false \
net.sf.jaer.JAERViewer
@@ -0,0 +1,8 @@
JOGL (Java OpenGL) fails on recent Linux systems that use the latest Mesa (open-source) drivers with AMD graphics cards.
More information here:
http://forum.jogamp.org/Mesa-17-2-0-renderer-driver-name-change-error-causes-GLProfile-not-mapped-initialization-error-td4038176.html
https://jogamp.org/bugzilla/show_bug.cgi?id=1357

This directory contains a patched version of JOGL for 64-bit Linux that fixes the problem.
If you are experiencing this failure, please edit the 'jAERViewer_linux.sh' file to load these JARs.
An exact description of how to do so is included in the .sh file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
$label=win 64bit JVM JDK 10
@@ -18,6 +18,7 @@
*/
package ch.unizh.ini.jaer.projects.minliu;

import ch.unizh.ini.jaer.projects.davis.frames.ApsFrameExtractor;
import ch.unizh.ini.jaer.projects.rbodo.opticalflow.AbstractMotionFlowIMU;
import java.awt.Dimension;
import java.awt.event.WindowAdapter;
@@ -42,13 +43,20 @@
import static net.sf.jaer.eventprocessing.EventFilter.log;
import net.sf.jaer.eventprocessing.FilterChain;
import net.sf.jaer.graphics.ImageDisplay;

import org.apache.commons.lang3.math.IEEE754rUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.math3.stat.StatUtils;
import org.apache.commons.math3.util.MathArrays;
import org.apache.commons.math3.util.MathUtils;

import org.jblas.DoubleMatrix;

import org.opencv.calib3d.Calib3d;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
/**
*
* @author minliu
@@ -64,12 +72,23 @@
private ImageDisplay.Legend sliceDepthmapImageDisplayLegend;
private static final String LEGEND_SLICES = "Depth image";
private boolean showDepthmap = getBoolean("showDepthmap", false);; // Display the depth map

private JFrame sliceRectImgFrame = null;
private ImageDisplay sliceRectImageDisplay; // makde a new ImageDisplay GLCanvas with default OpenGL capabilities
private ImageDisplay.Legend sliceRectImageDisplayLegend;
private static final String RECT_LEGEND_SLICES = "Rect image";
private boolean showRectimg = getBoolean("showRectimg", false);; // Display the rectified image

private final ApsFrameExtractor apsFrameExtractor;

public RosbagVOFlow(AEChip chip) {
super(chip);
FilterChain chain = new FilterChain(chip);
VOGTReader = new RosbagVOGTReader(chip);
chain.add(VOGTReader);
apsFrameExtractor = new ApsFrameExtractor(chip);
apsFrameExtractor.setShowAPSFrameDisplay(false);
chain.add(apsFrameExtractor);
setEnclosedFilterChain(chain);

getSupport().addPropertyChangeListener(AEInputStream.EVENT_REWOUND, this);
@@ -99,7 +118,7 @@ public EventPacket filterPacket(EventPacket in) {
}

float[] depth_image = VOGTReader.getCurrent_depth_image();


DoubleMatrix current_pose_se3 = VOGTReader.getCurrentPoseSe3();
if(showDepthmap && depth_image != null && chip != null) {
@@ -108,7 +127,31 @@ public EventPacket filterPacket(EventPacket in) {
for (int index = 0; index < depth_image.length; index++) {
depth_image_reverse[index] = depth_image[(chip.getSizeY() - index/chip.getSizeX() - 1) * chip.getSizeX() + index%chip.getSizeX()]/depth_max;
}
drawSlices(depth_image_reverse);
drawDepth(depth_image_reverse);
}

float[] aps_buffer = apsFrameExtractor.getDisplayBuffer();
float[] aps_image = new float[aps_buffer.length];
float aps_image_max = IEEE754rUtils.max(aps_buffer);
for (int index = 0; index < aps_buffer.length; index++) {
aps_image[index] = aps_buffer[(chip.getSizeY() - index/chip.getSizeX() - 1)
* chip.getSizeX() + index%chip.getSizeX()]/aps_image_max;
}
// Mat exp_img = Imgcodecs.imread("G:/MVSEC/ApsFrame-2018-04-12T22-29-37+0200.png", 0);
// exp_img.convertTo(exp_img, CvType.CV_32FC1);
Mat raw_img = new Mat(apsFrameExtractor.width, apsFrameExtractor.height, CvType.CV_32FC1);
raw_img.put(0, 0, aps_image);
Mat undistorted_img = new Mat();
Mat K = Mat.eye(3, 3, CvType.CV_32FC1);
K.put(0, 0, 226.3802, 0, 173.6471, 0, 226.1500, 133.7327, 0, 0, 1);
// System.out.println(img.dump());
Mat D = Mat.zeros(1, 4, CvType.CV_32FC1);
D.put(0, 0, 0, 0, 0, 0);
Calib3d.undistortImage(raw_img, undistorted_img, K, D);
float[] undistorted_image = new float[(int)(undistorted_img.total() * undistorted_img.channels())];
undistorted_img.get(0, 0, undistorted_image);
if(showRectimg && undistorted_image != null && chip != null) {
drawRectImg(undistorted_image);
}

// Se3Info se3Info = se3InfoList.get(se3InfoList.size() - 1);
@@ -186,7 +229,7 @@ public void propertyChange(PropertyChangeEvent evt) {
}
}

private void drawSlices(float[] depth) {
private void drawDepth(float[] depth) {
// log.info("drawing slices");
if (sliceDepthMapFrame == null) {
String windowName = "Depth images";
@@ -240,6 +283,61 @@ synchronized public void setShowDepthmap(boolean showDepthmap) {
this.showDepthmap = showDepthmap;
getSupport().firePropertyChange("showDepthmap", old, this.showDepthmap);
putBoolean("showDepthmap", showDepthmap);
}

private void drawRectImg(float[] rectImg) {
// log.info("drawing slices");
if (sliceRectImgFrame == null) {
String windowName = "Rectified images";
sliceRectImgFrame = new JFrame(windowName);
sliceRectImgFrame.setLayout(new BoxLayout(sliceRectImgFrame.getContentPane(), BoxLayout.Y_AXIS));
sliceRectImgFrame.setPreferredSize(new Dimension(600, 600));
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
sliceRectImageDisplay = ImageDisplay.createOpenGLCanvas();
sliceRectImageDisplay.setBorderSpacePixels(10);
sliceRectImageDisplay.setImageSize(sizex, sizey);
sliceRectImageDisplay.setSize(200, 200);
sliceRectImageDisplay.setGrayValue(0);
sliceRectImageDisplayLegend = sliceRectImageDisplay.addLegend(RECT_LEGEND_SLICES, 0, -10);
panel.add(sliceRectImageDisplay);

sliceRectImgFrame.getContentPane().add(panel);
sliceRectImgFrame.pack();
sliceRectImgFrame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
setShowRectimg(false);
}
});
}
if (!sliceRectImgFrame.isVisible()) {
sliceRectImgFrame.setVisible(true);
}

sliceRectImageDisplay.clearImage();

sliceRectImageDisplay.setPixmapFromGrayArray(rectImg);
if (sliceRectImageDisplayLegend != null) {
sliceRectImageDisplayLegend.s
= RECT_LEGEND_SLICES;
}

sliceRectImageDisplay.repaint();
}

public boolean isShowRectimg() {
return showRectimg;
}

/**
* @param showSlices
* @param showSlices the option of displaying bitmap
*/
synchronized public void setShowRectimg(boolean showRectimg) {
boolean old = this.showRectimg;
this.showRectimg = showRectimg;
getSupport().firePropertyChange("showRectimg", old, this.showRectimg);
putBoolean("showRectimg", showRectimg);
}
}
@@ -302,7 +302,7 @@ public void loadInputSpecification(File yamlFile) throws FileNotFoundException,

public synchronized void doLoadLabels() {
File file = null;
file = openFileDialogAndGetFile("Choose a labels file, one label per line", KEY_LABELS_FILENAME, "","labelsFile.txt", "txt");
file = openFileDialogAndGetFile("Choose a labels file, one label per line", KEY_LABELS_FILENAME, "", "labelsFile.txt", "txt");
if (file == null) {
return;
}
@@ -424,7 +424,7 @@ public void initFilter() {
if (f.exists() && f.isFile()) {
loadNetwork(f);
if (preferenceExists(KEY_LABELS_FILENAME)) {
File l = new File(getString(KEY_LABELS_FILENAME,""));
File l = new File(getString(KEY_LABELS_FILENAME, ""));
if (l.exists() && l.isFile()) {
loadLabels(l);
}
@@ -480,6 +480,8 @@ protected void loadNetwork(File f) {
apsDvsNet.setSoftMaxOutput(softMaxOutput); // must set manually since net doesn't know option kept here.
apsDvsNet.setZeroPadding(zeroPadding); // must set manually since net doesn't know option kept here.
dvsFramer.setFromNetwork(apsDvsNet);
} else {
log.warning("file " + f + " does not exist");
}
} catch (IOException ex) {
log.warning("Couldn't load the CNN from file " + f + ": got exception " + ex);
Oops, something went wrong.

0 comments on commit 7e094ec

Please sign in to comment.
You can’t perform that action at this time.