Loading FaceData/pom.xml 0 → 100644 +104 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>cz.fidentis</groupId> <artifactId>FIDENTIS-Analyst-parent</artifactId> <version>master-SNAPSHOT</version> </parent> <artifactId>FaceData</artifactId> <packaging>nbm</packaging> <build> <plugins> <plugin> <groupId>org.apache.netbeans.utilities</groupId> <artifactId>nbm-maven-plugin</artifactId> <extensions>true</extensions> <configuration> <useOSGiDependencies>true</useOSGiDependencies> <publicPackages> <!-- expose API/packages to other modules --> <publicPackage>cz.fidentis.analyst.data.face</publicPackage> </publicPackages> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> </archive> </configuration> </plugin> <!-- Check code style --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>${version.maven.plugin.checkstyle}</version> <executions> <execution> <id>validate</id> <phase>validate</phase> <configuration> <configLocation>codestyle.xml</configLocation> <consoleOutput>true</consoleOutput> <failOnViolation>${checkstyle.fail}</failOnViolation> <violationSeverity>${checkstyle.severity}</violationSeverity> <includeTestSourceDirectory>false</includeTestSourceDirectory> </configuration> <goals> <goal>check</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> </repositories> <dependencies> <dependency> <groupId>${project.groupId}</groupId> <artifactId>GeometryData</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>LandmarksData</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>SpacePartitioningData</artifactId> <version>${project.version}</version> </dependency> <!-- https://mvnrepository.com/artifact/javax.vecmath/vecmath --> <dependency> <groupId>javax.vecmath</groupId> <artifactId>vecmath</artifactId> <version>${version.javax.vecmath}</version> </dependency> <dependency> <groupId>org.objenesis</groupId> <artifactId>objenesis</artifactId> <version>3.2</version> </dependency> <dependency> <groupId>com.esotericsoftware</groupId> <artifactId>kryo</artifactId> <version>5.3.0</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>${version.com.google.guava}</version> </dependency> </dependencies> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> </project> FaceData/src/main/java/cz/fidentis/analyst/data/face/HumanFace.java 0 → 100644 +204 −0 Original line number Diff line number Diff line package cz.fidentis.analyst.data.face; import cz.fidentis.analyst.data.kdtree.KdTree; import cz.fidentis.analyst.data.landmarks.Landmark; import cz.fidentis.analyst.data.mesh.MeshModel; import cz.fidentis.analyst.data.octree.Octree; 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 java.io.IOException; import java.io.Serializable; import java.util.List; /** * A single human face consisting of a mesh, feature points, space partitioning structures, and other data structures. * * @author Radek Oslejsek * @author Matej Kovar * @author Katerina Zarska */ public interface HumanFace extends HumanFaceEventBus, Serializable { /** * Returns the triangular mesh model of the human face. * * @return the triangular mesh model of the human face */ MeshModel getMeshModel(); /** * Sets the mesh model. * * @param meshModel new mesh model, must not be {@code null} * @throws IllegalArgumentException if new model is missing */ void setMeshModel(MeshModel meshModel); /** * Sets the symmetry plane. If the input argument is {@code null}, then removes the plane. * * @param plane The new symmetry plane; Must not be {@code null} */ void setSymmetryPlane(Plane plane); /** * * @return The face's symmetry plane */ Plane getSymmetryPlane(); /** * Returns {@code true} if the face has the symmetry plane computed. * @return {@code true} if the face has the symmetry plane computed. */ boolean hasSymmetryPlane(); /** * Reads feature points from a file on the given path. * * @param path Directory where the file is located * @param fileName Name of the file * @throws IOException on I/O failure */ void loadFeaturePoints(String path, String fileName) throws IOException; /** * Returns all feature points or empty list. * * @return The face's feature points. */ List<Landmark> getAllLandmarks(); /** * @return list of standard feature points */ List<Landmark> getStandardFeaturePoints(); /** * @return list of custom feature points */ List<Landmark> getCustomLandmarks(); /** * Checks if HumanFace has feature points * @return true if yes and false if not */ boolean hasLandmarks(); /** * Returns unique ID of the face. * * @return unique ID of the face. */ String getId(); /** * Returns canonical path to the face file * @return canonical path to the face file */ String getPath(); /** * Returns short name of the face without its path in the name. May not be unique. * @return short name of the face without its path in the name */ String getShortName(); /** * Returns already computed octree of the triangular mesh or {@code null}. * @return Already computed octree of the triangular mesh or {@code null} */ Octree getOctree(); /** * Checks if HumanFace has octree calculated * @return true if yes and false if not */ boolean hasOctree(); /** * Sets teh octree * * @param octree New octree. Can be {@code null} */ void setOctree(Octree octree); /** * Returns already computed k-d tree of the triangular mesh or {@code null}. * @return Already computed k-d tree of the triangular mesh or {@code null} */ KdTree getKdTree(); /** * Sets teh octree * * @param kdTree New k-d tree. Can be {@code null} */ void setKdTree(KdTree kdTree); /** * Checks if HumanFace has KdTree calculated * @return true if yes and false if not */ boolean hasKdTree(); /** * Returns Interactive mask. The mask can be empty; * * @return the interactive mask */ SurfaceMask getSurfaceMask(); /** * Returns a deep copy of current state. * @return a deep copy of current state. */ HumanFaceState getState(); /** * Falls back to given state. No event is triggered - it up to the caller. * @param state Old state. Must not be {@code null} */ void setState(HumanFaceState state); /** * Gets the glyphs of the face or empty list * * @return list of glyphs or empty list */ List<Glyph> getGlyphs(); /** * Sets the glyphs. * * @param glyphs Glyphs. Can be {@code null} */ void setGlyphs(List<Glyph> glyphs); /** * Checks if the human face has assigned glyphs * @return {@code true}, if the glyphs exist */ boolean hasGlyphs(); /** * Returns bounding box or {@code null} * @return bounding box or {@code null} */ Box getBoundingBox(); /** * Set a bounding box. * @param boundingBox Bounding box or {@code null} */ void setBoundingBox(Box boundingBox); /** * Checks if the human face has assigned a bounding box * @return {@code true}, if the bounding box exists */ boolean hasBoundingBox(); } HumanFace/src/main/java/cz/fidentis/analyst/events/HumanFaceEvent.java→FaceData/src/main/java/cz/fidentis/analyst/data/face/HumanFaceEvent.java +2 −4 Original line number Diff line number Diff line package cz.fidentis.analyst.events; import cz.fidentis.analyst.face.HumanFace; package cz.fidentis.analyst.data.face; /** * The root type for events fired by the {@link cz.fidentis.analyst.face.HumanFace}. * The root type for events fired by the {@link HumanFace}. * * @author Radek Oslejsek */ Loading FaceData/src/main/java/cz/fidentis/analyst/data/face/HumanFaceEventBus.java 0 → 100644 +41 −0 Original line number Diff line number Diff line package cz.fidentis.analyst.data.face; import cz.fidentis.analyst.data.face.impl.HumanFaceImpl; /** * Changes in the human face and its data structures (e.g., mesh model, etc.) * can be monitored by listeners. Listeners have to implement the * {@link HumanFaceListener} interface and they have to be * registered using the {@link HumanFaceImpl#registerListener} method. * Then they are informed about changes in the human automatically via methods * prescribed by the interface. * * @author Radek Oslejsek * @author Matej Kovar * @author Katerina Zarska */ public interface HumanFaceEventBus { /** * Registers listeners (objects concerned in the human face changes) to receive events. * If listener is {@code null}, no exception is thrown and no action is taken. * * @param listener Listener concerned in the human face changes. */ void registerListener(HumanFaceListener listener); /** * Unregisters listeners from receiving events. * * @param listener Registered listener */ void unregisterListener(HumanFaceListener listener); /** * Broadcast event to registered listeners. * * @param evt Event to be triggered. */ void announceEvent(HumanFaceEvent evt); } FaceData/src/main/java/cz/fidentis/analyst/data/face/HumanFaceFactory.java 0 → 100644 +47 −0 Original line number Diff line number Diff line package cz.fidentis.analyst.data.face; import cz.fidentis.analyst.data.face.impl.HumanFaceImpl; import cz.fidentis.analyst.data.mesh.MeshModel; import java.io.File; import java.io.IOException; /** * This interface provides services that instantiates a human face. * * @author Radek Oslejsek */ public interface HumanFaceFactory { /** * Reads a 3D human face from the given OBJ file. * * @param file OBJ file * @param loadLandmarks If {@code true}, then the constructor aims to load landmarks as well * @throws IOException on I/O failure */ static HumanFace create(File file, boolean loadLandmarks) throws IOException { return new HumanFaceImpl(file, loadLandmarks); } /** * Reads a 3D human face from the given OBJ file. * * @param file OBJ file * @throws IOException on I/O failure */ static HumanFace create(File file) throws IOException { return create(file, true); } /** * Creates a human face from existing mesh model. The mesh model is stored directly (not copied). * * @param model Mesh model * @param id Canonical path to the OBJ file * @throws IllegalArgumentException if the {@code model} is {@code null} */ static HumanFace create(MeshModel model, String id) { return new HumanFaceImpl(model , id); } } Loading
FaceData/pom.xml 0 → 100644 +104 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>cz.fidentis</groupId> <artifactId>FIDENTIS-Analyst-parent</artifactId> <version>master-SNAPSHOT</version> </parent> <artifactId>FaceData</artifactId> <packaging>nbm</packaging> <build> <plugins> <plugin> <groupId>org.apache.netbeans.utilities</groupId> <artifactId>nbm-maven-plugin</artifactId> <extensions>true</extensions> <configuration> <useOSGiDependencies>true</useOSGiDependencies> <publicPackages> <!-- expose API/packages to other modules --> <publicPackage>cz.fidentis.analyst.data.face</publicPackage> </publicPackages> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> </archive> </configuration> </plugin> <!-- Check code style --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>${version.maven.plugin.checkstyle}</version> <executions> <execution> <id>validate</id> <phase>validate</phase> <configuration> <configLocation>codestyle.xml</configLocation> <consoleOutput>true</consoleOutput> <failOnViolation>${checkstyle.fail}</failOnViolation> <violationSeverity>${checkstyle.severity}</violationSeverity> <includeTestSourceDirectory>false</includeTestSourceDirectory> </configuration> <goals> <goal>check</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> </repositories> <dependencies> <dependency> <groupId>${project.groupId}</groupId> <artifactId>GeometryData</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>LandmarksData</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>SpacePartitioningData</artifactId> <version>${project.version}</version> </dependency> <!-- https://mvnrepository.com/artifact/javax.vecmath/vecmath --> <dependency> <groupId>javax.vecmath</groupId> <artifactId>vecmath</artifactId> <version>${version.javax.vecmath}</version> </dependency> <dependency> <groupId>org.objenesis</groupId> <artifactId>objenesis</artifactId> <version>3.2</version> </dependency> <dependency> <groupId>com.esotericsoftware</groupId> <artifactId>kryo</artifactId> <version>5.3.0</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>${version.com.google.guava}</version> </dependency> </dependencies> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> </project>
FaceData/src/main/java/cz/fidentis/analyst/data/face/HumanFace.java 0 → 100644 +204 −0 Original line number Diff line number Diff line package cz.fidentis.analyst.data.face; import cz.fidentis.analyst.data.kdtree.KdTree; import cz.fidentis.analyst.data.landmarks.Landmark; import cz.fidentis.analyst.data.mesh.MeshModel; import cz.fidentis.analyst.data.octree.Octree; 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 java.io.IOException; import java.io.Serializable; import java.util.List; /** * A single human face consisting of a mesh, feature points, space partitioning structures, and other data structures. * * @author Radek Oslejsek * @author Matej Kovar * @author Katerina Zarska */ public interface HumanFace extends HumanFaceEventBus, Serializable { /** * Returns the triangular mesh model of the human face. * * @return the triangular mesh model of the human face */ MeshModel getMeshModel(); /** * Sets the mesh model. * * @param meshModel new mesh model, must not be {@code null} * @throws IllegalArgumentException if new model is missing */ void setMeshModel(MeshModel meshModel); /** * Sets the symmetry plane. If the input argument is {@code null}, then removes the plane. * * @param plane The new symmetry plane; Must not be {@code null} */ void setSymmetryPlane(Plane plane); /** * * @return The face's symmetry plane */ Plane getSymmetryPlane(); /** * Returns {@code true} if the face has the symmetry plane computed. * @return {@code true} if the face has the symmetry plane computed. */ boolean hasSymmetryPlane(); /** * Reads feature points from a file on the given path. * * @param path Directory where the file is located * @param fileName Name of the file * @throws IOException on I/O failure */ void loadFeaturePoints(String path, String fileName) throws IOException; /** * Returns all feature points or empty list. * * @return The face's feature points. */ List<Landmark> getAllLandmarks(); /** * @return list of standard feature points */ List<Landmark> getStandardFeaturePoints(); /** * @return list of custom feature points */ List<Landmark> getCustomLandmarks(); /** * Checks if HumanFace has feature points * @return true if yes and false if not */ boolean hasLandmarks(); /** * Returns unique ID of the face. * * @return unique ID of the face. */ String getId(); /** * Returns canonical path to the face file * @return canonical path to the face file */ String getPath(); /** * Returns short name of the face without its path in the name. May not be unique. * @return short name of the face without its path in the name */ String getShortName(); /** * Returns already computed octree of the triangular mesh or {@code null}. * @return Already computed octree of the triangular mesh or {@code null} */ Octree getOctree(); /** * Checks if HumanFace has octree calculated * @return true if yes and false if not */ boolean hasOctree(); /** * Sets teh octree * * @param octree New octree. Can be {@code null} */ void setOctree(Octree octree); /** * Returns already computed k-d tree of the triangular mesh or {@code null}. * @return Already computed k-d tree of the triangular mesh or {@code null} */ KdTree getKdTree(); /** * Sets teh octree * * @param kdTree New k-d tree. Can be {@code null} */ void setKdTree(KdTree kdTree); /** * Checks if HumanFace has KdTree calculated * @return true if yes and false if not */ boolean hasKdTree(); /** * Returns Interactive mask. The mask can be empty; * * @return the interactive mask */ SurfaceMask getSurfaceMask(); /** * Returns a deep copy of current state. * @return a deep copy of current state. */ HumanFaceState getState(); /** * Falls back to given state. No event is triggered - it up to the caller. * @param state Old state. Must not be {@code null} */ void setState(HumanFaceState state); /** * Gets the glyphs of the face or empty list * * @return list of glyphs or empty list */ List<Glyph> getGlyphs(); /** * Sets the glyphs. * * @param glyphs Glyphs. Can be {@code null} */ void setGlyphs(List<Glyph> glyphs); /** * Checks if the human face has assigned glyphs * @return {@code true}, if the glyphs exist */ boolean hasGlyphs(); /** * Returns bounding box or {@code null} * @return bounding box or {@code null} */ Box getBoundingBox(); /** * Set a bounding box. * @param boundingBox Bounding box or {@code null} */ void setBoundingBox(Box boundingBox); /** * Checks if the human face has assigned a bounding box * @return {@code true}, if the bounding box exists */ boolean hasBoundingBox(); }
HumanFace/src/main/java/cz/fidentis/analyst/events/HumanFaceEvent.java→FaceData/src/main/java/cz/fidentis/analyst/data/face/HumanFaceEvent.java +2 −4 Original line number Diff line number Diff line package cz.fidentis.analyst.events; import cz.fidentis.analyst.face.HumanFace; package cz.fidentis.analyst.data.face; /** * The root type for events fired by the {@link cz.fidentis.analyst.face.HumanFace}. * The root type for events fired by the {@link HumanFace}. * * @author Radek Oslejsek */ Loading
FaceData/src/main/java/cz/fidentis/analyst/data/face/HumanFaceEventBus.java 0 → 100644 +41 −0 Original line number Diff line number Diff line package cz.fidentis.analyst.data.face; import cz.fidentis.analyst.data.face.impl.HumanFaceImpl; /** * Changes in the human face and its data structures (e.g., mesh model, etc.) * can be monitored by listeners. Listeners have to implement the * {@link HumanFaceListener} interface and they have to be * registered using the {@link HumanFaceImpl#registerListener} method. * Then they are informed about changes in the human automatically via methods * prescribed by the interface. * * @author Radek Oslejsek * @author Matej Kovar * @author Katerina Zarska */ public interface HumanFaceEventBus { /** * Registers listeners (objects concerned in the human face changes) to receive events. * If listener is {@code null}, no exception is thrown and no action is taken. * * @param listener Listener concerned in the human face changes. */ void registerListener(HumanFaceListener listener); /** * Unregisters listeners from receiving events. * * @param listener Registered listener */ void unregisterListener(HumanFaceListener listener); /** * Broadcast event to registered listeners. * * @param evt Event to be triggered. */ void announceEvent(HumanFaceEvent evt); }
FaceData/src/main/java/cz/fidentis/analyst/data/face/HumanFaceFactory.java 0 → 100644 +47 −0 Original line number Diff line number Diff line package cz.fidentis.analyst.data.face; import cz.fidentis.analyst.data.face.impl.HumanFaceImpl; import cz.fidentis.analyst.data.mesh.MeshModel; import java.io.File; import java.io.IOException; /** * This interface provides services that instantiates a human face. * * @author Radek Oslejsek */ public interface HumanFaceFactory { /** * Reads a 3D human face from the given OBJ file. * * @param file OBJ file * @param loadLandmarks If {@code true}, then the constructor aims to load landmarks as well * @throws IOException on I/O failure */ static HumanFace create(File file, boolean loadLandmarks) throws IOException { return new HumanFaceImpl(file, loadLandmarks); } /** * Reads a 3D human face from the given OBJ file. * * @param file OBJ file * @throws IOException on I/O failure */ static HumanFace create(File file) throws IOException { return create(file, true); } /** * Creates a human face from existing mesh model. The mesh model is stored directly (not copied). * * @param model Mesh model * @param id Canonical path to the OBJ file * @throws IllegalArgumentException if the {@code model} is {@code null} */ static HumanFace create(MeshModel model, String id) { return new HumanFaceImpl(model , id); } }