added tuple input (for stereo matching)
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
package de.unidue.nes.gpu.testframework;
|
||||
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.imgcodecs.Imgcodecs;
|
||||
|
||||
import de.unidue.nes.gpu.testframework.input.MatInput;
|
||||
import de.unidue.nes.gpu.testframework.opencv.Imgproc;
|
||||
import de.unidue.nes.gpu.testframework.input.MatTuple;
|
||||
import de.unidue.nes.gpu.testframework.input.MatTupleInput;
|
||||
|
||||
/**
|
||||
* @author Roch P., Shahbaz Nejad B.
|
||||
@@ -18,17 +17,12 @@ public class Main {
|
||||
|
||||
// main method only used to test
|
||||
public static void main(String[] args) {
|
||||
TestUtils<Mat> utils = new TestUtils<>();
|
||||
utils.setCommandPipeline(matInput -> {
|
||||
Mat mat = matInput.get();
|
||||
Mat edges = new Mat();
|
||||
Imgproc.cvtColor(mat, mat, org.opencv.imgproc.Imgproc.COLOR_BGR2GRAY);
|
||||
Mat m2 = new Mat();
|
||||
// Imgproc.medianBlur(mat, m2, 15);
|
||||
Imgproc.GaussianBlur(mat, m2, new Size(15, 15), -1);
|
||||
Imgproc.Canny(m2, edges, 15, 45);
|
||||
TestUtils<MatTuple> utils = new TestUtils<>();
|
||||
utils.setCommandPipeline(tupleInput -> {
|
||||
Mat left = tupleInput.get().left;
|
||||
Mat right = tupleInput.get().right;
|
||||
});
|
||||
utils.setInput(new MatInput(Imgcodecs.imread("src/main/resources/skyscraper_large.jpg")));
|
||||
utils.setInput(new MatTupleInput(Imgcodecs.imread("src/main/resources/left_small.png"), Imgcodecs.imread("src/main/resources/right_small.png")));
|
||||
// utils.setInput(new MatInput(Imgcodecs.imread("src/main/resources/car.jpg")));
|
||||
// utils.setInput(new MatInput(Imgcodecs.imread("src/main/resources/skyscraper_small.jpg")));
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package de.unidue.nes.gpu.testframework.input;
|
||||
|
||||
import org.opencv.core.Mat;
|
||||
|
||||
/**
|
||||
* @author Roch P., Shahbaz Nejad B.
|
||||
*/
|
||||
public class MatTuple {
|
||||
|
||||
public final Mat left;
|
||||
public final Mat right;
|
||||
|
||||
public MatTuple(Mat left, Mat right) {
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package de.unidue.nes.gpu.testframework.input;
|
||||
|
||||
import org.opencv.core.Mat;
|
||||
|
||||
/**
|
||||
* @author Roch P., Shahbaz Nejad B.
|
||||
*
|
||||
*/
|
||||
public class MatTupleInput implements Input<MatTuple> {
|
||||
|
||||
private final MatTuple tuple;
|
||||
|
||||
public MatTupleInput(Mat left, Mat right) {
|
||||
this.tuple = new MatTuple(left, right);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyTo(Input<MatTuple> other) {
|
||||
this.tuple.left.copyTo(other.get().left);
|
||||
this.tuple.right.copyTo(other.get().right);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Input<MatTuple> createCopy() {
|
||||
return new MatTupleInput(this.tuple.left, this.tuple.right);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MatTuple get() {
|
||||
return this.tuple;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user