Loading FaceData/src/main/java/cz/fidentis/analyst/data/face/HumanFaceFactory.java +14 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ import cz.fidentis.analyst.data.mesh.MeshModel; import java.io.File; import java.io.IOException; import java.io.ObjectInputStream; /** * This interface provides services that instantiates a human face. Loading Loading @@ -34,6 +35,19 @@ public interface HumanFaceFactory { return create(file, true); } /** * Recover human face from serialized dump file. As the dump file can contain additional * objects, e.g., camera, it is supposed that the given input stream is set to a human face object. * * @param in A dump file as object input stream * @return The instance of the human face * @throws IOException If reading fails * @throws ClassNotFoundException If there is no human face in the stream */ static HumanFace create(ObjectInputStream in) throws IOException, ClassNotFoundException { return (HumanFace) in.readObject(); } /** * Creates a human face from existing mesh model. The mesh model is stored directly (not copied). * Loading FaceData/src/main/java/cz/fidentis/analyst/data/face/impl/HumanFaceImpl.java +11 −12 Original line number Diff line number Diff line Loading @@ -2,10 +2,13 @@ package cz.fidentis.analyst.data.face.impl; import com.google.common.eventbus.EventBus; import cz.fidentis.analyst.Logger; import cz.fidentis.analyst.data.face.HumanFace; import cz.fidentis.analyst.data.face.HumanFaceEvent; import cz.fidentis.analyst.data.face.HumanFaceListener; import cz.fidentis.analyst.data.face.HumanFaceState; import cz.fidentis.analyst.data.kdtree.KdTree; import cz.fidentis.analyst.data.landmarks.Landmark; import cz.fidentis.analyst.data.landmarks.LandmarksIO; import cz.fidentis.analyst.data.mesh.MeshFacet; import cz.fidentis.analyst.data.mesh.MeshIO; import cz.fidentis.analyst.data.mesh.MeshModel; import cz.fidentis.analyst.data.octree.Octree; Loading @@ -13,10 +16,6 @@ import cz.fidentis.analyst.data.shapes.Box; import cz.fidentis.analyst.data.shapes.Glyph; import cz.fidentis.analyst.data.shapes.Plane; import cz.fidentis.analyst.data.shapes.SurfaceMask; import cz.fidentis.analyst.data.face.HumanFace; import cz.fidentis.analyst.data.face.HumanFaceEvent; import cz.fidentis.analyst.data.face.HumanFaceListener; import cz.fidentis.analyst.data.face.HumanFaceState; import java.io.File; import java.io.IOException; Loading Loading @@ -77,9 +76,7 @@ public class HumanFaceImpl implements HumanFace { meshModel.simplifyModel(); this.id = file.getCanonicalPath(); meshModel.getFacets().stream() .filter(f -> !f.hasVertexNormals()) .forEach(MeshFacet::calculateVertexNormals); meshModel.estimateMissingVertexNormals(); eventBus = new EventBus(); Loading Loading @@ -173,7 +170,7 @@ public class HumanFaceImpl implements HumanFace { @Override public List<Landmark> getAllLandmarks() { return featurePoints == null ? Collections.EMPTY_LIST : Collections.unmodifiableList(featurePoints); return featurePoints == null ? Collections.emptyList() : Collections.unmodifiableList(featurePoints); } @Override Loading Loading @@ -208,7 +205,7 @@ public class HumanFaceImpl implements HumanFace { @Override public String getShortName() { String name = id.substring(0, id.lastIndexOf('.')); // remove extension name = name.substring(name.lastIndexOf(File.separatorChar) + 1, name.length()); name = name.substring(name.lastIndexOf(File.separatorChar) + 1); return name; } Loading Loading @@ -279,8 +276,10 @@ public class HumanFaceImpl implements HumanFace { this.symmetryPlane = state.symmetryPlane(); this.kdTree = state.kdTree(); this.octree = state.octree(); if (this.featurePoints != null) { this.featurePoints.clear(); this.featurePoints = state.featurePoints(); } this.boundingBox = state.boundingBox(); this.glyphs = state.glyphs(); } Loading FaceData/src/main/java/cz/fidentis/analyst/data/face/impl/HumanFaceMemoryManagerImpl.java +2 −1 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ public class HumanFaceMemoryManagerImpl implements HumanFaceMemoryManager { HumanFaceMemoryManagerImpl.kryo = new Kryo(); HumanFaceMemoryManagerImpl.kryo.setInstantiatorStrategy(new DefaultInstantiatorStrategy(new StdInstantiatorStrategy())); HumanFaceMemoryManagerImpl.kryo.register(HumanFace.class); HumanFaceMemoryManagerImpl.kryo.register(HumanFaceImpl.class); MeshFactory.registerClassesInKryo(kryo); HumanFaceMemoryManagerImpl.kryo.register(Box.class); HumanFaceMemoryManagerImpl.kryo.register(Plane.class); Loading Loading @@ -340,7 +341,7 @@ public class HumanFaceMemoryManagerImpl implements HumanFaceMemoryManager { */ try (Input in = new Input(new FileInputStream(dumpFile))) { return kryo.readObject(in, HumanFace.class); return kryo.readObject(in, HumanFaceImpl.class); } catch(Exception ex) { throw new IOException(ex); } Loading GUI/pom.xml +0 −1 Original line number Diff line number Diff line Loading @@ -185,5 +185,4 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <groupId>cz.fidentis</groupId> </project> GUI/src/main/java/cz/fidentis/analyst/gui/elements/PlaneManipulationPanel.java +4 −4 Original line number Diff line number Diff line Loading @@ -61,9 +61,9 @@ public class PlaneManipulationPanel extends JPanel { setBackground(Color.LIGHT_GRAY); setBorder(new EmptyBorder(5, 5, 5, 5)); this.addMouseListener(mouseListener); spinSlider.getSpinner().setMinimumSize(new Dimension(45, 20)); spinSlider.getSpinner().setPreferredSize(new Dimension(48, 20)); spinSlider.getSpinner().setMaximumSize(new Dimension(50, 20)); spinSlider.getSpinner().setMinimumSize(new Dimension(45, 25)); spinSlider.getSpinner().setPreferredSize(new Dimension(48, 25)); spinSlider.getSpinner().setMaximumSize(new Dimension(50, 25)); } public DrawableCuttingPlane getCurrentPlane() { Loading Loading @@ -298,7 +298,7 @@ public class PlaneManipulationPanel extends JPanel { private void initCheckBox() { visibilityCheckBox = new JCheckBox(); visibilityCheckBox.setText("Show"); visibilityCheckBox.setText("Show in 3D"); visibilityCheckBox.addMouseListener(mouseListener); visibilityCheckBox.addItemListener(checkBoxSelectionListener); } Loading Loading
FaceData/src/main/java/cz/fidentis/analyst/data/face/HumanFaceFactory.java +14 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ import cz.fidentis.analyst.data.mesh.MeshModel; import java.io.File; import java.io.IOException; import java.io.ObjectInputStream; /** * This interface provides services that instantiates a human face. Loading Loading @@ -34,6 +35,19 @@ public interface HumanFaceFactory { return create(file, true); } /** * Recover human face from serialized dump file. As the dump file can contain additional * objects, e.g., camera, it is supposed that the given input stream is set to a human face object. * * @param in A dump file as object input stream * @return The instance of the human face * @throws IOException If reading fails * @throws ClassNotFoundException If there is no human face in the stream */ static HumanFace create(ObjectInputStream in) throws IOException, ClassNotFoundException { return (HumanFace) in.readObject(); } /** * Creates a human face from existing mesh model. The mesh model is stored directly (not copied). * Loading
FaceData/src/main/java/cz/fidentis/analyst/data/face/impl/HumanFaceImpl.java +11 −12 Original line number Diff line number Diff line Loading @@ -2,10 +2,13 @@ package cz.fidentis.analyst.data.face.impl; import com.google.common.eventbus.EventBus; import cz.fidentis.analyst.Logger; import cz.fidentis.analyst.data.face.HumanFace; import cz.fidentis.analyst.data.face.HumanFaceEvent; import cz.fidentis.analyst.data.face.HumanFaceListener; import cz.fidentis.analyst.data.face.HumanFaceState; import cz.fidentis.analyst.data.kdtree.KdTree; import cz.fidentis.analyst.data.landmarks.Landmark; import cz.fidentis.analyst.data.landmarks.LandmarksIO; import cz.fidentis.analyst.data.mesh.MeshFacet; import cz.fidentis.analyst.data.mesh.MeshIO; import cz.fidentis.analyst.data.mesh.MeshModel; import cz.fidentis.analyst.data.octree.Octree; Loading @@ -13,10 +16,6 @@ import cz.fidentis.analyst.data.shapes.Box; import cz.fidentis.analyst.data.shapes.Glyph; import cz.fidentis.analyst.data.shapes.Plane; import cz.fidentis.analyst.data.shapes.SurfaceMask; import cz.fidentis.analyst.data.face.HumanFace; import cz.fidentis.analyst.data.face.HumanFaceEvent; import cz.fidentis.analyst.data.face.HumanFaceListener; import cz.fidentis.analyst.data.face.HumanFaceState; import java.io.File; import java.io.IOException; Loading Loading @@ -77,9 +76,7 @@ public class HumanFaceImpl implements HumanFace { meshModel.simplifyModel(); this.id = file.getCanonicalPath(); meshModel.getFacets().stream() .filter(f -> !f.hasVertexNormals()) .forEach(MeshFacet::calculateVertexNormals); meshModel.estimateMissingVertexNormals(); eventBus = new EventBus(); Loading Loading @@ -173,7 +170,7 @@ public class HumanFaceImpl implements HumanFace { @Override public List<Landmark> getAllLandmarks() { return featurePoints == null ? Collections.EMPTY_LIST : Collections.unmodifiableList(featurePoints); return featurePoints == null ? Collections.emptyList() : Collections.unmodifiableList(featurePoints); } @Override Loading Loading @@ -208,7 +205,7 @@ public class HumanFaceImpl implements HumanFace { @Override public String getShortName() { String name = id.substring(0, id.lastIndexOf('.')); // remove extension name = name.substring(name.lastIndexOf(File.separatorChar) + 1, name.length()); name = name.substring(name.lastIndexOf(File.separatorChar) + 1); return name; } Loading Loading @@ -279,8 +276,10 @@ public class HumanFaceImpl implements HumanFace { this.symmetryPlane = state.symmetryPlane(); this.kdTree = state.kdTree(); this.octree = state.octree(); if (this.featurePoints != null) { this.featurePoints.clear(); this.featurePoints = state.featurePoints(); } this.boundingBox = state.boundingBox(); this.glyphs = state.glyphs(); } Loading
FaceData/src/main/java/cz/fidentis/analyst/data/face/impl/HumanFaceMemoryManagerImpl.java +2 −1 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ public class HumanFaceMemoryManagerImpl implements HumanFaceMemoryManager { HumanFaceMemoryManagerImpl.kryo = new Kryo(); HumanFaceMemoryManagerImpl.kryo.setInstantiatorStrategy(new DefaultInstantiatorStrategy(new StdInstantiatorStrategy())); HumanFaceMemoryManagerImpl.kryo.register(HumanFace.class); HumanFaceMemoryManagerImpl.kryo.register(HumanFaceImpl.class); MeshFactory.registerClassesInKryo(kryo); HumanFaceMemoryManagerImpl.kryo.register(Box.class); HumanFaceMemoryManagerImpl.kryo.register(Plane.class); Loading Loading @@ -340,7 +341,7 @@ public class HumanFaceMemoryManagerImpl implements HumanFaceMemoryManager { */ try (Input in = new Input(new FileInputStream(dumpFile))) { return kryo.readObject(in, HumanFace.class); return kryo.readObject(in, HumanFaceImpl.class); } catch(Exception ex) { throw new IOException(ex); } Loading
GUI/pom.xml +0 −1 Original line number Diff line number Diff line Loading @@ -185,5 +185,4 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <groupId>cz.fidentis</groupId> </project>
GUI/src/main/java/cz/fidentis/analyst/gui/elements/PlaneManipulationPanel.java +4 −4 Original line number Diff line number Diff line Loading @@ -61,9 +61,9 @@ public class PlaneManipulationPanel extends JPanel { setBackground(Color.LIGHT_GRAY); setBorder(new EmptyBorder(5, 5, 5, 5)); this.addMouseListener(mouseListener); spinSlider.getSpinner().setMinimumSize(new Dimension(45, 20)); spinSlider.getSpinner().setPreferredSize(new Dimension(48, 20)); spinSlider.getSpinner().setMaximumSize(new Dimension(50, 20)); spinSlider.getSpinner().setMinimumSize(new Dimension(45, 25)); spinSlider.getSpinner().setPreferredSize(new Dimension(48, 25)); spinSlider.getSpinner().setMaximumSize(new Dimension(50, 25)); } public DrawableCuttingPlane getCurrentPlane() { Loading Loading @@ -298,7 +298,7 @@ public class PlaneManipulationPanel extends JPanel { private void initCheckBox() { visibilityCheckBox = new JCheckBox(); visibilityCheckBox.setText("Show"); visibilityCheckBox.setText("Show in 3D"); visibilityCheckBox.addMouseListener(mouseListener); visibilityCheckBox.addItemListener(checkBoxSelectionListener); } Loading