Search in sources :

Example 96 with Mat

use of org.opencv.core.Mat in project Relic_Main by TeamOverdrive.

the class Converters method Mat_to_vector_vector_KeyPoint.

public static void Mat_to_vector_vector_KeyPoint(Mat m, List<MatOfKeyPoint> kps) {
    if (kps == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    if (m == null)
        throw new java.lang.IllegalArgumentException("Input Mat can't be null");
    List<Mat> mats = new ArrayList<Mat>(m.rows());
    Mat_to_vector_Mat(m, mats);
    for (Mat mi : mats) {
        MatOfKeyPoint vkp = new MatOfKeyPoint(mi);
        kps.add(vkp);
        mi.release();
    }
    mats.clear();
}
Also used : Mat(org.opencv.core.Mat) MatOfKeyPoint(org.opencv.core.MatOfKeyPoint) ArrayList(java.util.ArrayList)

Example 97 with Mat

use of org.opencv.core.Mat in project Relic_Main by TeamOverdrive.

the class Converters method vector_vector_char_to_Mat.

// vector_vector_char
public static Mat vector_vector_char_to_Mat(List<MatOfByte> lvb, List<Mat> mats) {
    Mat res;
    int lCount = (lvb != null) ? lvb.size() : 0;
    if (lCount > 0) {
        for (MatOfByte vb : lvb) mats.add(vb);
        res = vector_Mat_to_Mat(mats);
    } else {
        res = new Mat();
    }
    return res;
}
Also used : Mat(org.opencv.core.Mat) MatOfByte(org.opencv.core.MatOfByte) Point(org.opencv.core.Point) MatOfKeyPoint(org.opencv.core.MatOfKeyPoint) KeyPoint(org.opencv.core.KeyPoint) MatOfPoint(org.opencv.core.MatOfPoint)

Example 98 with Mat

use of org.opencv.core.Mat in project Relic_Main by TeamOverdrive.

the class Converters method vector_char_to_Mat.

public static Mat vector_char_to_Mat(List<Byte> bs) {
    Mat res;
    int count = (bs != null) ? bs.size() : 0;
    if (count > 0) {
        res = new Mat(count, 1, CvType.CV_8SC1);
        byte[] buff = new byte[count];
        for (int i = 0; i < count; i++) {
            byte b = bs.get(i);
            buff[i] = b;
        }
        res.put(0, 0, buff);
    } else {
        res = new Mat();
    }
    return res;
}
Also used : Mat(org.opencv.core.Mat) Point(org.opencv.core.Point) MatOfKeyPoint(org.opencv.core.MatOfKeyPoint) KeyPoint(org.opencv.core.KeyPoint) MatOfPoint(org.opencv.core.MatOfPoint)

Example 99 with Mat

use of org.opencv.core.Mat in project Relic_Main by TeamOverdrive.

the class Converters method vector_vector_DMatch_to_Mat.

// vector_vector_DMatch
public static Mat vector_vector_DMatch_to_Mat(List<MatOfDMatch> lvdm, List<Mat> mats) {
    Mat res;
    int lCount = (lvdm != null) ? lvdm.size() : 0;
    if (lCount > 0) {
        for (MatOfDMatch vdm : lvdm) mats.add(vdm);
        res = vector_Mat_to_Mat(mats);
    } else {
        res = new Mat();
    }
    return res;
}
Also used : Mat(org.opencv.core.Mat) MatOfDMatch(org.opencv.core.MatOfDMatch) Point(org.opencv.core.Point) MatOfKeyPoint(org.opencv.core.MatOfKeyPoint) KeyPoint(org.opencv.core.KeyPoint) MatOfPoint(org.opencv.core.MatOfPoint)

Example 100 with Mat

use of org.opencv.core.Mat in project Relic_Main by TeamOverdrive.

the class Converters method vector_Mat_to_Mat.

public static Mat vector_Mat_to_Mat(List<Mat> mats) {
    Mat res;
    int count = (mats != null) ? mats.size() : 0;
    if (count > 0) {
        res = new Mat(count, 1, CvType.CV_32SC2);
        int[] buff = new int[count * 2];
        for (int i = 0; i < count; i++) {
            long addr = mats.get(i).nativeObj;
            buff[i * 2] = (int) (addr >> 32);
            buff[i * 2 + 1] = (int) (addr & 0xffffffff);
        }
        res.put(0, 0, buff);
    } else {
        res = new Mat();
    }
    return res;
}
Also used : Mat(org.opencv.core.Mat) Point(org.opencv.core.Point) MatOfKeyPoint(org.opencv.core.MatOfKeyPoint) KeyPoint(org.opencv.core.KeyPoint) MatOfPoint(org.opencv.core.MatOfPoint)

Aggregations

Mat (org.opencv.core.Mat)239 ArrayList (java.util.ArrayList)34 Point (org.opencv.core.Point)33 MatOfPoint (org.opencv.core.MatOfPoint)27 MatOfKeyPoint (org.opencv.core.MatOfKeyPoint)19 KeyPoint (org.opencv.core.KeyPoint)18 Size (org.opencv.core.Size)17 Rect (org.opencv.core.Rect)15 Scalar (org.opencv.core.Scalar)9 File (java.io.File)7 BufferedImage (java.awt.image.BufferedImage)5 FilterContext (de.serviceflow.frankenstein.plugin.api.FilterContext)4 SegmentVideoFilter (de.serviceflow.frankenstein.plugin.api.SegmentVideoFilter)4 DefaultFilterContext (de.serviceflow.frankenstein.vf.DefaultFilterContext)4 VideoFilter (de.serviceflow.frankenstein.vf.VideoFilter)4 DataBufferByte (java.awt.image.DataBufferByte)4 FilterElement (de.serviceflow.frankenstein.vf.FilterElement)3 IOException (java.io.IOException)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 ImageNotFoundException (org.getopentest.exceptions.ImageNotFoundException)3