Skip to content

Commit

Permalink
dependency cleanup (1)
Browse files Browse the repository at this point in the history
  • Loading branch information
olir committed Apr 8, 2018
1 parent a1afb81 commit 8639677
Show file tree
Hide file tree
Showing 15 changed files with 99 additions and 34 deletions.
2 changes: 2 additions & 0 deletions app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
</dependencies>

<profiles>
<!--
<profile>
<id>OPENH264_LIBRARY_PATH-defined</id>
<activation>
Expand All @@ -66,6 +67,7 @@
<openh264opt>-DOPENH264_LIBRARY_PATH_UNSET</openh264opt>
</properties>
</profile>
-->
</profiles>

<!-- Build Settings -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public String prepareLoadLibrary(Class<?> invokerClass, String libraryBasename)
return plattformLibraryName;
}

// direct, plattform-specific
public void prepareLoadLibraryWithoutArch(Class<?> invokerClass, String name, String suffix) throws UnsatisfiedLinkError {
prepareLoadLibraryImpl(invokerClass, name, suffix);
}

private static void prepareLoadLibraryImpl(Class<?> invokerClass, String plattformLibraryName, String suffix)
throws UnsatisfiedLinkError {
synchronized (loadedLibraries) {
Expand Down
34 changes: 16 additions & 18 deletions app/src/main/java/de/serviceflow/frankenstein/PluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ public class PluginManager {

private final List<SegmentVideoFilter> segmentFilters = new ArrayList<SegmentVideoFilter>();

public String getImplementationVersion() {
return this.getClass().getPackage().getImplementationVersion();
}

public void load(Configuration configuration) {
loadOpenCV();
loadSegmentFilters();
}

private void loadOpenCV() {
// https://github.com/openpnp/opencv
try {
Class.forName("nu.pattern.OpenCV").getMethod("loadShared", (Class<?>[]) null).invoke((Object[]) null,
(Object[]) null);
// nu.pattern.OpenCV.loadShared();
// nu.pattern.OpenCV.loadLocal();
// System.out.println("Loading from " + System.getProperty("java.library.path"));
System.loadLibrary(org.opencv.core.Core.NATIVE_LIBRARY_NAME);
} catch (ClassNotFoundException e) {
System.out.println("WARNING: nu.pattern.OpenCV not found.");
} catch (Throwable t) {
System.out.println("WARNING: nu.pattern.OpenCV not loaded.");
}
String opencvlib = "opencv_java320";
String ffmpeglib = "opencv_ffmpeg320_64";
String suffix = ".dll";

LibraryManager lm = new LibraryManager();
lm.prepareLoadLibraryWithoutArch(this.getClass(), ffmpeglib, suffix);
System.loadLibrary(ffmpeglib);
lm.prepareLoadLibraryWithoutArch(this.getClass(), opencvlib, suffix);
System.loadLibrary(opencvlib);
}

public List<SegmentVideoFilter> getLocalFilters() {
Expand Down Expand Up @@ -83,8 +83,6 @@ public void loadSegmentFilters() {
/*
* String pluginOpenCVbase; String pluginJogAmpbase;
*
* String version =
* getClass().getPackage().getImplementationVersion();
*
* if (version != null && !version.endsWith("-SNAPSHOT")) { fs =
* "/"; pluginOpenCVbase =
Expand All @@ -104,12 +102,13 @@ public void loadSegmentFilters() {
* baseFromAppResources + "plugin-jogamp" + fs + "java" + fs +
* "target").toURI().toURL().toExternalForm(); }
*
* System.out.println("version (e.g. 0.3.3) = " + version);
*
*
* String pluginOpenCVRef = pluginOpenCVbase + "/" +
* "plugin-opencv-" + version + ".jar"; String pluginJogAmpRef =
* pluginJogAmpbase + "/" + "plugin-jogamp-" + version + ".jar";
*/

TextSet pluginSet = loadPluginSet();

for (Iterator<String> piter = pluginSet.iterator(); piter.hasNext();) {
Expand Down Expand Up @@ -168,8 +167,7 @@ private Set<String> loadFilterSet(String pluginRef) {
if (s != null) {
filterSet.load(new InputStreamReader(s));
s.close();
}
else {
} else {
System.err.println("Warning: Plugin contains no filter.set file: " + pluginRef);
}
return filterSet;
Expand Down
18 changes: 15 additions & 3 deletions app/src/main/java/de/serviceflow/frankenstein/TextSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
import java.io.Reader;
import java.io.Writer;
import java.util.AbstractSet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;

public class TextSet extends AbstractSet<String> {

private SortedSet<String> s = Collections.synchronizedSortedSet(new TreeSet<String>());
private List<String> comments = Collections.synchronizedList(new ArrayList<String>());

@Override
public Iterator<String> iterator() {
Expand All @@ -32,10 +35,19 @@ public void clear() {

@Override
public boolean add(String e) {
return s.add(e);
if (e.startsWith("#")) {
comments.add(e);
return true;
}
else
return s.add(e);
}

public void store(Writer writer) throws IOException {
for (String c : comments) {
writer.write(c);
writer.write('\n');
}
for (Iterator<String> iter = iterator(); iter.hasNext();) {
String text = iter.next();
text.replace("\\", "\\\\");
Expand Down Expand Up @@ -66,12 +78,12 @@ public void load(Reader reader) throws IOException {
}
text.replace("\\\\", "\\");
if (text.length()>0)
s.add(text);
add(text);
}
if (multiLineBuffer!=null) {
multiLineBuffer.replace("\\\\", "\\");
if (multiLineBuffer.length()>0)
s.add(multiLineBuffer);
add(multiLineBuffer);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void start(Stage primaryStage) {
try {
theStage = primaryStage;

theStage.setTitle(APP_NAME);
setDocumentInTitle(null);
theStage.setMinHeight(HEIGHT);
theStage.setMaxHeight(HEIGHT);
theStage.setHeight(HEIGHT);
Expand Down Expand Up @@ -149,7 +149,7 @@ public void setDocumentInTitle(String name) {
if (name != null)
theStage.setTitle(APP_NAME + " - " + name);
else
theStage.setTitle(APP_NAME);
theStage.setTitle(APP_NAME + " v" + getInitialConfiguration().getPluginManager().getImplementationVersion() );
}

}
Binary file removed app/src/main/resources/opencv_ffmpeg320.dll
Binary file not shown.
8 changes: 6 additions & 2 deletions app/src/main/resources/plugin.set
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
../../../../plugin-opencv/distribution/target
../../../../plugin-jogamp/distribution/target
# Frankenstein plugin configuration
#===================================
#https://oss.sonatype.org/service/local/repositories/releases/content/de/serviceflow/frankenstein/plugin/jogamp/distribution/0.3.6/distribution-0.3.6.jar
#https://oss.sonatype.org/service/local/repositories/releases/content/de/serviceflow/frankenstein/plugin/opencv/distribution/0.3.6/distribution-0.3.6.jar
#plugin-jogamp/distribution/target
plugin-opencv/distribution/target
12 changes: 10 additions & 2 deletions doc/Description.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Frankenstein VR
A Video Stream Analysis and Manipulation Framework for Java™ and C++, where custom filters can be simply added into the processing pipeline.
A Video Stream Analysis and Manipulation Framework for Java™ and C++,
where custom filters can be simply added into the processing pipeline.

Plattforms: Windows 64. Linux will follow "soon".

The Tool supports
* [OpenCV](http://www.opencv.org/releases.html) - computer vision and machine learning
Expand Down Expand Up @@ -47,7 +50,12 @@ FFMPEG build contains H264 encoder based on the OpenH264 library, that should be
Downloaded binary file can be placed into global system path (System32 or SysWOW64) or near application binaries (bin/).
You can also specify location of binary file via OPENH264_LIBRARY_PATH environment variable.

## For developers ##
## Your custom Video Filters ##
Frankstein supports loading external filters plugins either from network or local.

After first run .frankenstein-plugin.set contains the list of sample filters.
Filter plugin jars are either specified by the directory location or an URL to the jar file.

When you work on custom filters, you can concentrate on manipulating images with the OpenCV or JogAmp libraries.
For more details read [SegmentFilters](https://olir.github.io/Frankenstein/doc/SegmentFilters.html).
To run on [Debian Linux click here](https://olir.github.io/Frankenstein/doc/DebianLinux.html).
Expand Down
16 changes: 13 additions & 3 deletions doc/SegmentFilters.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Frankenstein VR - Segment Filters
# Frankenstein - Segment Filters

## Available Filters
## Available Sample Filters

* Black and White - Converts to grayscale.
* Stereo Distance - Manipulates the stereo effect distance of side by side videos
** Distance slider: frame can appear farer or closer

## Howto create a new filter (!!! UNDER CONSTRUCTION !!!)
# Howto create a new filter (!!! UNDER CONSTRUCTION !!!)

## Overview
A filter is made of the following parts:
Expand Down Expand Up @@ -161,4 +161,14 @@ Some messages should appear: **Hello from C++!** ...
### Plattform Issues
* java.lang.UnsatisfiedLinkError: "Can't load AMD 64-bit .dll on a IA 32-bit platform": In win32/pom.xml set the property gcc.customflags to -m32

## Filter-Plugins ##
Your own plugin must depend on the Frankenstein API with the following Maven coordinates:
```
<dependency>
<groupId>de.serviceflow.frankenstein.plugin</groupId>
<artifactId>api</artifactId>
<version>0.3.6</version>
<scope>provided</scope>
</dependency>
```

1 change: 1 addition & 0 deletions plugin-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<groupId>org.openpnp</groupId>
<artifactId>opencv</artifactId>
<version>3.2.0-1</version>
<scope>provided</scope>
</dependency>
</dependencies>

Expand Down
7 changes: 7 additions & 0 deletions plugin-jogamp/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,17 @@
<!-- Credits to http://www.tricoder.net/blog/?p=197 -->

<dependencies>
<dependency>
<groupId>org.openpnp</groupId>
<artifactId>opencv</artifactId>
<version>3.2.0-1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.serviceflow.frankenstein.plugin</groupId>
<artifactId>api</artifactId>
<version>0.3.7-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- jogamp dependencies -->
<dependency>
Expand Down
6 changes: 6 additions & 0 deletions plugin-jogamp/native/win64/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>de.serviceflow.frankenstein.plugin</groupId>
<artifactId>api</artifactId>
<version>0.3.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
Expand Down
8 changes: 7 additions & 1 deletion plugin-opencv/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@
<!-- Credits to http://www.tricoder.net/blog/?p=197 -->

<dependencies>
<dependency>
<groupId>org.openpnp</groupId>
<artifactId>opencv</artifactId>
<version>3.2.0-1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.serviceflow.frankenstein.plugin</groupId>
<artifactId>api</artifactId>
<version>0.3.7-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
Expand Down
6 changes: 6 additions & 0 deletions plugin-opencv/native/win64/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>de.serviceflow.frankenstein.plugin</groupId>
<artifactId>api</artifactId>
<version>0.3.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<modules>
<module>plugin-api</module>
<module>plugin-opencv</module>
<module>plugin-jogamp</module>
<!-- <module>plugin-jogamp</module> -->
<module>app</module>
</modules>

Expand All @@ -52,11 +52,11 @@
, click "close"/confirm, wait/click refresh, in case of error check Activity-Tab
and ensure http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22nexus-staging-maven-plugin%22
is latest version.
In case of success click "release", wait until operation finishs
In case of success click "release", wait until operation ends, ignore errors,
and check Result via "Artifact Search" with group id
then git add/commit/push, check build is passing on github and release there,
then increment version plus add -snapshot to Maven Coordinates with:
mvn versions:set -DnewVersion=X.Y.Z-SNAPSHOT , and git push to origin.
mvn versions:set -DnewVersion=X.Y.Z-SNAPSHOT , and git add/commit/push to origin.
-->
<distributionManagement>
<snapshotRepository>
Expand Down

0 comments on commit 8639677

Please sign in to comment.