use of org.opencv.core.Mat in project Frankenstein by olir.
the class CloneLR method process.
@Override
public Mat process(Mat sourceFrame, int frameId, FilterContext context) {
// System.out.println("???");
Rect roi = new Rect(0, 0, sourceFrame.cols(), sourceFrame.rows());
sourceFrame.copyTo(new Mat(newFrame, roi));
// System.out.println("???"+newFrame.cols()+" "+sourceFrame.cols());
roi = new Rect(sourceFrame.cols(), 0, sourceFrame.cols(), sourceFrame.rows());
sourceFrame.copyTo(new Mat(newFrame, roi));
return newFrame;
}
use of org.opencv.core.Mat in project Frankenstein by olir.
the class VideoInput method open.
@Override
public void open(ProcessingListener l) {
movie = new VideoCapture(videofile);
if (!movie.isOpened()) {
String path = System.getProperty("OPENH264_LIBRARY_PATH");
if (path == null)
System.out.println("Warning: OPENH264_LIBRARY_PATH not set. Input Movie Opening Error for " + videofile);
throw new RuntimeException("Input Movie Opening Error for " + videofile + ". Current path=" + new File(".").getAbsolutePath());
}
currentFrame = new Mat();
currentPos = 0;
grab();
currentFrame = retrieve(currentFrame, l);
frames = (int) movie.get(Videoio.CAP_PROP_FRAME_COUNT);
fps = movie.get(Videoio.CAP_PROP_FPS);
width = (int) movie.get(Videoio.CAP_PROP_FRAME_WIDTH);
height = (int) movie.get(Videoio.CAP_PROP_FRAME_HEIGHT);
}
use of org.opencv.core.Mat in project Frankenstein by olir.
the class StereoDistanceFilter method process.
@Override
public Mat process(Mat sourceFrame, int frameId, FilterContext context) {
if (newFrame == null || newFrame.cols() != sourceFrame.cols() || newFrame.rows() != sourceFrame.rows()) {
newFrame = sourceFrame.clone();
perspectiveMultiplier = sourceFrame.cols() / 320;
if (perspectiveMultiplier < 1)
perspectiveMultiplier = 1;
}
newFrame.setTo(new Scalar(0, 0, 0));
Rect roi = new Rect(val(0, perspective(), 0, -1), 0, (sourceFrame.cols() >> 1) - Math.abs(perspective()), sourceFrame.rows());
sourceFrame.submat(new Rect((Math.abs(perspective()) >> 1), 0, (sourceFrame.cols() >> 1) - Math.abs(perspective()), sourceFrame.rows())).copyTo(new Mat(newFrame, roi));
roi = new Rect(val(sourceFrame.cols() >> 1, -perspective(), sourceFrame.cols() >> 1, -1), 0, (sourceFrame.cols() >> 1) - Math.abs(perspective()), sourceFrame.rows());
sourceFrame.submat(new Rect((sourceFrame.cols() >> 1) + (Math.abs(perspective()) >> 1), 0, (sourceFrame.cols() >> 1) - Math.abs(perspective()), sourceFrame.rows())).copyTo(new Mat(newFrame, roi));
return newFrame;
}
use of org.opencv.core.Mat in project Frankenstein by olir.
the class LDelay method configure.
@Override
public Mat configure(Mat sourceFrame) {
newFrame = sourceFrame.clone();
frameBuffer = sourceFrame.clone();
if (delayLeft) {
// Take over right side to left side in buffer
Rect roi = new Rect(0, 0, sourceFrame.cols() >> 1, sourceFrame.rows());
sourceFrame.submat(new Rect(sourceFrame.cols() >> 1, 0, sourceFrame.cols() >> 1, sourceFrame.rows())).copyTo(new Mat(frameBuffer, roi));
} else {
// Take over left side to right side in buffer
Rect roi = new Rect(sourceFrame.cols() >> 1, 0, sourceFrame.cols() >> 1, sourceFrame.rows());
sourceFrame.submat(new Rect(0, 0, sourceFrame.cols() >> 1, sourceFrame.rows())).copyTo(new Mat(frameBuffer, roi));
}
return newFrame;
}
use of org.opencv.core.Mat in project Frankenstein by olir.
the class RL2LR method process.
@Override
public Mat process(Mat sourceFrame, int frameId, FilterContext context) {
Rect roi = new Rect(0, 0, sourceFrame.cols() >> 1, sourceFrame.rows());
sourceFrame.submat(new Rect(sourceFrame.cols() >> 1, 0, sourceFrame.cols() >> 1, sourceFrame.rows())).copyTo(new Mat(newFrame, roi));
roi = new Rect(sourceFrame.cols() >> 1, 0, sourceFrame.cols() >> 1, sourceFrame.rows());
sourceFrame.submat(new Rect(0, 0, sourceFrame.cols() >> 1, sourceFrame.rows())).copyTo(new Mat(newFrame, roi));
return newFrame;
}
Aggregations