use of org.opencv.core.Rect in project Relic_Main by TeamOverdrive.
the class Imgproc method boundingRect.
//
// C++: Rect boundingRect(vector_Point points)
//
// javadoc: boundingRect(points)
public static Rect boundingRect(MatOfPoint points) {
Mat points_mat = points;
Rect retVal = new Rect(boundingRect_0(points_mat.nativeObj));
return retVal;
}
use of org.opencv.core.Rect in project Frankenstein by olir.
the class Anaglyph2LR method process.
@Override
public Mat process(Mat sourceFrame, int frameId, FilterContext context) {
List<Mat> sourcePlanes = new ArrayList<Mat>();
// planes[2] is the red channel
Core.split(sourceFrame, sourcePlanes);
List<Mat> leftPlanes = new ArrayList<Mat>();
List<Mat> rightPlanes = new ArrayList<Mat>();
leftPlanes.add(sourcePlanes.get(2));
leftPlanes.add(sourcePlanes.get(2));
leftPlanes.add(sourcePlanes.get(2));
Core.merge(leftPlanes, leftFrame);
rightPlanes.add(sourcePlanes.get(1));
rightPlanes.add(sourcePlanes.get(1));
rightPlanes.add(sourcePlanes.get(1));
Core.merge(rightPlanes, rightFrame);
Imgproc.resize(leftFrame, halfFrame1, new Size(smallWidth, smallHeight), 0, 0, Imgproc.INTER_AREA);
Imgproc.resize(rightFrame, halfFrame2, new Size(smallWidth, smallHeight), 0, 0, Imgproc.INTER_AREA);
Rect roi = new Rect(0, 0, smallWidth, smallHeight);
halfFrame1.copyTo(new Mat(newFrame, roi));
roi = new Rect(smallWidth, 0, smallWidth, smallHeight);
halfFrame2.copyTo(new Mat(newFrame, roi));
return newFrame;
}
use of org.opencv.core.Rect in project Frankenstein by olir.
the class LDelay method process.
@Override
public Mat process(Mat sourceFrame, int frameId, FilterContext context) {
int x1 = 0;
int x2 = sourceFrame.cols() >> 1;
if (!delayLeft) {
x1 = x2;
x2 = 0;
}
// Take over left side from Buffer
Rect roi = new Rect(x1, 0, sourceFrame.cols() >> 1, sourceFrame.rows());
frameBuffer.submat(new Rect(x1, 0, sourceFrame.cols() >> 1, sourceFrame.rows())).copyTo(new Mat(newFrame, roi));
// Copy Left Side from Source to Buffer
roi = new Rect(x1, 0, sourceFrame.cols() >> 1, sourceFrame.rows());
sourceFrame.submat(new Rect(x1, 0, sourceFrame.cols() >> 1, sourceFrame.rows())).copyTo(new Mat(frameBuffer, roi));
// Take over right side unchanged
roi = new Rect(x2, 0, sourceFrame.cols() >> 1, sourceFrame.rows());
sourceFrame.submat(new Rect(x2, 0, sourceFrame.cols() >> 1, sourceFrame.rows())).copyTo(new Mat(newFrame, roi));
return newFrame;
}
use of org.opencv.core.Rect in project Frankenstein by olir.
the class OU2LR method process.
@Override
public Mat process(Mat sourceFrame, int frameId, FilterContext context) {
Rect roi = new Rect(0, 0, smallWidth, smallHeight);
sourceFrame.submat(new Rect(0, 0, sourceFrame.cols(), sourceFrame.rows() >> 1)).copyTo(upperFrame);
sourceFrame.submat(new Rect(0, sourceFrame.rows() >> 1, sourceFrame.cols(), sourceFrame.rows() >> 1)).copyTo(lowerFrame);
Imgproc.resize(upperFrame, leftFrame, new Size(smallWidth, smallHeight), 0, 0, Imgproc.INTER_AREA);
Imgproc.resize(lowerFrame, rightFrame, new Size(smallWidth, smallHeight), 0, 0, Imgproc.INTER_AREA);
newFrame.setTo(new Scalar(255, 0, 0));
roi = new Rect(0, 0, smallWidth, smallHeight);
leftFrame.copyTo(new Mat(newFrame, roi));
roi = new Rect(smallWidth, 0, smallWidth, smallHeight);
rightFrame.copyTo(new Mat(newFrame, roi));
return newFrame;
}
use of org.opencv.core.Rect in project Frankenstein by olir.
the class LR2VR180 method process.
@Override
public Mat process(Mat sourceFrame, int frameId, FilterContext context) {
Rect roiDest, roiSource;
if (!coneCorrection) {
roiDest = new Rect(borderW, borderH, smallWidth, smallHeight);
sourceFrame.submat(new Rect(0, 0, smallWidth, smallHeight)).copyTo(new Mat(newFrame, roiDest));
roiDest = new Rect(smallWidth + 3 * borderW, borderH, smallWidth, smallHeight);
sourceFrame.submat(new Rect(smallWidth, 0, smallWidth, smallHeight)).copyTo(new Mat(newFrame, roiDest));
} else {
int ymid = smallHeight >> 1;
for (int i = 0; i < STEPS_PER_DIRECTION; i++) {
roiSource = new Rect(0, ymid + srcStepOffset[i], sourceFrame.cols(), srcStepHeight[i]);
Imgproc.resize(sourceFrame.submat(roiSource), bufferFrame[i], new Size(sourceFrame.cols(), destStepHeight[i]), 0, 0, Imgproc.INTER_AREA);
// bufferFrame.setTo(new Scalar((i % 2) * 255, 0, 255));
roiDest = new Rect(borderW, borderH + ymid + destStepOffset[i], smallWidth, destStepHeight[i]);
bufferFrame[i].submat(new Rect(0, 0, smallWidth, destStepHeight[i])).copyTo(new Mat(newFrame, roiDest));
roiDest = new Rect(smallWidth + 3 * borderW, borderH + ymid + destStepOffset[i], smallWidth, destStepHeight[i]);
bufferFrame[i].submat(new Rect(smallWidth, 0, smallWidth, destStepHeight[i])).copyTo(new Mat(newFrame, roiDest));
roiSource = new Rect(0, ymid - srcStepOffset[i] - srcStepHeight[i], sourceFrame.cols(), srcStepHeight[i]);
Imgproc.resize(sourceFrame.submat(roiSource), bufferFrame[i], new Size(sourceFrame.cols(), destStepHeight[i]), 0, 0, Imgproc.INTER_AREA);
// bufferFrame.setTo(new Scalar((i % 2) * 255, 255, 0));
roiDest = new Rect(borderW, borderH + ymid - destStepHeight[i] - destStepOffset[i], smallWidth, destStepHeight[i]);
bufferFrame[i].submat(new Rect(0, 0, smallWidth, destStepHeight[i])).copyTo(new Mat(newFrame, roiDest));
roiDest = new Rect(smallWidth + 3 * borderW, borderH + ymid - destStepHeight[i] - destStepOffset[i], smallWidth, destStepHeight[i]);
bufferFrame[i].submat(new Rect(smallWidth, 0, smallWidth, destStepHeight[i])).copyTo(new Mat(newFrame, roiDest));
}
}
return newFrame;
}
Aggregations