-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started on native Video-Equalizer Filter
- Loading branch information
Showing
19 changed files
with
144 additions
and
812 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
**/.settings/ | ||
**/target/ | ||
**/velocity.log | ||
**/*.log | ||
**/Thumbs.db | ||
**/*.dll | ||
**/.externalToolBuilders/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
app/src/main/java/de/screenflow/frankenstein/vf/segment/VideoEqualizerConfigController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package de.screenflow.frankenstein.vf.segment; | ||
|
||
public class VideoEqualizerConfigController { | ||
|
||
} |
53 changes: 53 additions & 0 deletions
53
app/src/main/java/de/screenflow/frankenstein/vf/segment/VideoEqualizerFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright 2017 Oliver Rode, https://github.com/olir/Frankenstein | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package de.screenflow.frankenstein.vf.segment; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.lang.reflect.Method; | ||
|
||
import org.opencv.core.Mat; | ||
|
||
public class VideoEqualizerFilter extends NativeSegmentFilter<VideoEqualizerConfigController> { | ||
|
||
private final static String JNI_FILTER_CLASS = "de.screenflow.frankenstein.vf.jni.VideoEqualizer"; | ||
|
||
private final Method jniProxyProcessMethod; | ||
|
||
@SuppressWarnings("unchecked") | ||
public VideoEqualizerFilter() throws UnsatisfiedLinkError { | ||
super("videoequalizer", JNI_FILTER_CLASS); | ||
try { | ||
jniProxyProcessMethod = getJniProxyClass().getMethod("process", Object.class, int.class); | ||
} catch (NoSuchMethodException | SecurityException | IllegalArgumentException e) { | ||
throw new RuntimeException("jni wrapper creation failed", e); | ||
} | ||
} | ||
|
||
@Override | ||
public Mat process(Mat sourceFrame, int frameId) { | ||
try { | ||
jniProxyProcessMethod.invoke(getJniProxy(), sourceFrame, frameId); | ||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { | ||
e.printStackTrace(); | ||
} | ||
return sourceFrame; | ||
} | ||
|
||
@Override | ||
protected void initializeController() { | ||
// getConfigController(). ... | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/src/main/resources/de/screenflow/frankenstein/vf/segment/videoequalizer.fxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.geometry.*?> | ||
<?import javafx.scene.text.*?> | ||
<?import javafx.scene.control.*?> | ||
<?import java.lang.*?> | ||
<?import javafx.scene.image.*?> | ||
<?import javafx.scene.layout.*?> | ||
<?import javafx.scene.layout.BorderPane?> | ||
|
||
<BorderPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.screenflow.frankenstein.vf.segment.VideoEqualizerConfigController"> | ||
</BorderPane> |
1 change: 1 addition & 0 deletions
1
app/src/main/resources/de/screenflow/frankenstein/vf/segment/videoequalizer.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name=Video-Equalizer |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../java/src/main/java/cc0/NativeFilter.java → ...low/frankenstein/vf/jni/NativeFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package cc0; | ||
package de.screenflow.frankenstein.vf.jni; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
9 changes: 9 additions & 0 deletions
9
jniplugin/java/src/main/java/de/screenflow/frankenstein/vf/jni/VideoEqualizer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package de.screenflow.frankenstein.vf.jni; | ||
|
||
public class VideoEqualizer extends NativeFilter { | ||
public VideoEqualizer() throws UnsatisfiedLinkError { | ||
} | ||
|
||
public native void init(); | ||
public native void process(Object mat, int frameId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <iostream> | ||
|
||
#include "nativeCode.h" // generated by javah via maven-native-plugin | ||
|
||
#include "opencv2/core/core.hpp" | ||
#include "JwMat.h" | ||
#include "jni_helper.h" | ||
#include "cv_helper.h" | ||
|
||
using namespace std; | ||
using namespace cv; | ||
|
||
JNIEXPORT void JNICALL Java_de_screenflow_frankenstein_vf_jni_VideoEqualizer_init | ||
(JNIEnv* env, jobject obj) | ||
{ | ||
JwMat* mat = JwMat::matptr; | ||
if (mat == NULL) { | ||
JwMat::matptr = new JwMat(env); | ||
} | ||
} | ||
|
||
JNIEXPORT void JNICALL Java_de_screenflow_frankenstein_vf_jni_VideoEqualizer_process | ||
(JNIEnv* env, jobject obj, | ||
jobject matobj, jint frameId) | ||
{ | ||
JwMat* mat = JwMat::matptr; | ||
int cols = mat->cols(env, matobj); | ||
int rows = mat->rows(env, matobj); | ||
cout << "rows=" << rows << ", cols=" << cols << endl; | ||
|
||
int channels = mat->channels(env, matobj); | ||
if (channels<3) { | ||
J_THROW("java/lang/Error", "channels < 3: "+mat->channels(env, matobj)); | ||
return; | ||
} | ||
|
||
int c0 = (unsigned char)POINT_CHANNEL_VALUE((cols>>1),(rows>>1),0,mat); | ||
int c1 = (unsigned char)POINT_CHANNEL_VALUE((cols>>1),(rows>>1),1,mat); | ||
int c2 = (unsigned char)POINT_CHANNEL_VALUE((cols>>1),(rows>>1),2,mat); | ||
cout << "RGB-values at " << (rows>>1) << "," << (cols>>1) << ": " << | ||
c2 << "/" << c1 << "/" << c0 << endl ; | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters