added MatArrayInput
This commit is contained in:
@@ -5,8 +5,7 @@ import org.opencv.core.MatOfDMatch;
|
||||
import org.opencv.core.MatOfKeyPoint;
|
||||
import org.opencv.imgcodecs.Imgcodecs;
|
||||
|
||||
import de.unidue.nes.gpu.testframework.input.MatTuple;
|
||||
import de.unidue.nes.gpu.testframework.input.MatTupleInput;
|
||||
import de.unidue.nes.gpu.testframework.input.MatArrayInput;
|
||||
import de.unidue.nes.gpu.testframework.opencv.DescriptorMatcher;
|
||||
import de.unidue.nes.gpu.testframework.opencv.Features2d;
|
||||
import de.unidue.nes.gpu.testframework.opencv.Imgproc;
|
||||
@@ -26,10 +25,10 @@ public class Main {
|
||||
// main method only used to test
|
||||
public static void main(String[] args) {
|
||||
|
||||
TestUtils<MatTuple> utils = new TestUtils<>();
|
||||
utils.setCommandPipeline(tuple -> {
|
||||
Mat mat = tuple.get().left;
|
||||
Mat other = tuple.get().right;
|
||||
TestUtils<Mat[]> utils = new TestUtils<>();
|
||||
utils.setCommandPipeline(arr -> {
|
||||
Mat mat = arr.get()[0];
|
||||
Mat other = arr.get()[1];
|
||||
|
||||
Imgproc.cvtColor(mat, mat, org.opencv.imgproc.Imgproc.COLOR_BGR2GRAY);
|
||||
Imgproc.cvtColor(other, other, org.opencv.imgproc.Imgproc.COLOR_BGR2GRAY);
|
||||
@@ -54,7 +53,7 @@ public class Main {
|
||||
|
||||
CustomTask.addTask(new DummyTask(mat, out, otherOut));
|
||||
});
|
||||
utils.setInput(new MatTupleInput(Imgcodecs.imread("src/main/resources/left_large.png"), Imgcodecs.imread("src/main/resources/right_large.png")));
|
||||
utils.setInput(new MatArrayInput(Imgcodecs.imread("src/main/resources/left_large.png"), Imgcodecs.imread("src/main/resources/right_large.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,39 @@
|
||||
package de.unidue.nes.gpu.testframework.input;
|
||||
|
||||
import org.opencv.core.Mat;
|
||||
|
||||
/**
|
||||
* @author Roch P., Shahbaz Nejad B.
|
||||
*
|
||||
*/
|
||||
public class MatArrayInput implements Input<Mat[]> {
|
||||
|
||||
private final Mat[] arr;
|
||||
|
||||
public MatArrayInput(Mat... mats) {
|
||||
this.arr = mats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyTo(Input<Mat[]> other) {
|
||||
for (int i = 0; i < this.arr.length; i++) {
|
||||
this.arr[i].copyTo(other.get()[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Input<Mat[]> createCopy() {
|
||||
Mat[] newArr = new Mat[this.arr.length];
|
||||
for (int i = 0; i < this.arr.length; i++) {
|
||||
newArr[i] = new Mat();
|
||||
this.arr[i].copyTo(newArr[i]);
|
||||
}
|
||||
return new MatArrayInput(newArr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mat[] get() {
|
||||
return this.arr;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user