Java Code Examples for org.opencv.core.MatOfRect

The following are top voted examples for showing how to use org.opencv.core.MatOfRect. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Image-Detection-Samples   File: EyesDetectionInteractorImpl.java   View source code 5 votes vote down vote up
/**
 * <p>Build a template from a specific eye area previously substracted
 * uses detectMultiScale for this area, then uses minMaxLoc method to
 * detect iris from the detected eye</p>
 *
 * @param area Preformatted Area
 * @param size minimum iris size
 * @param grayMat image in gray
 * @param rgbaMat image in color
 * @param detectorEye Haar Cascade classifier
 * @return built template
 */
@NonNull
private static Mat buildTemplate(Rect area, final int size,
                                 @NonNull Mat grayMat,
                                 @NonNull Mat rgbaMat,
                                 CascadeClassifier detectorEye) {
    Mat template = new Mat();
    Mat graySubMatEye = grayMat.submat(area);
    MatOfRect eyes = new MatOfRect();
    Rect eyeTemplate;
    detectorEye.detectMultiScale(graySubMatEye, eyes, 1.15, 2,
            Objdetect.CASCADE_FIND_BIGGEST_OBJECT
                    | Objdetect.CASCADE_SCALE_IMAGE, new Size(EYE_MIN_SIZE, EYE_MIN_SIZE),
            new Size());

    Rect[] eyesArray = eyes.toArray();
    if (eyesArray.length > 0) {
        Rect e = eyesArray[0];
        e.x = area.x + e.x;
        e.y = area.y + e.y;
        Rect eyeRectangle = getEyeArea((int) e.tl().x,
                (int) (e.tl().y + e.height * 0.4),
                e.width,
                (int) (e.height * 0.6));
        graySubMatEye = grayMat.submat(eyeRectangle);
        Mat rgbaMatEye = rgbaMat.submat(eyeRectangle);


        Core.MinMaxLocResult minMaxLoc = Core.minMaxLoc(graySubMatEye);

        FaceDrawerOpenCV.drawIrisCircle(rgbaMatEye, minMaxLoc);
        Point iris = new Point();
        iris.x = minMaxLoc.minLoc.x + eyeRectangle.x;
        iris.y = minMaxLoc.minLoc.y + eyeRectangle.y;
        eyeTemplate = getEyeArea((int) iris.x - size / 2,
                (int) iris.y
                        - size / 2, size, size);
        FaceDrawerOpenCV.drawEyeRectangle(eyeTemplate, rgbaMat);
        template = (grayMat.submat(eyeTemplate)).clone();
    }
    return template;
}
 
Example 2
Project: EyeShopping   File: HOGDescriptor.java   View source code 5 votes vote down vote up
public  void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold, Size winStride, Size padding, double scale, double finalThreshold, boolean useMeanshiftGrouping)
{
    Mat foundLocations_mat = foundLocations;
    Mat foundWeights_mat = foundWeights;
    detectMultiScale_0(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height, scale, finalThreshold, useMeanshiftGrouping);
    
    return;
}
 
Example 3
Project: android-age-estimator   File: HOGDescriptor.java   View source code 5 votes vote down vote up
public  void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights)
{
    Mat foundLocations_mat = foundLocations;
    Mat foundWeights_mat = foundWeights;
    detectMultiScale_1(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj);
    
    return;
}
 
Example 4
Project: NotifyTools   File: Objdetect.java   View source code 5 votes vote down vote up
public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold)
{
    Mat rectList_mat = rectList;
    Mat weights_mat = weights;
    groupRectangles_1(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold);
    
    return;
}
 
Example 5
Project: Checkerboard-IMU-Comparator   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights)
{
    Mat objects_mat = objects;
    Mat rejectLevels_mat = rejectLevels;
    Mat levelWeights_mat = levelWeights;
    detectMultiScale3_1(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj);
    
    return;
}
 
Example 6
Project: MOAAP   File: MSER.java   View source code 5 votes vote down vote up
public  void detectRegions(Mat image, List<MatOfPoint> msers, MatOfRect bboxes)
{
    Mat msers_mat = new Mat();
    Mat bboxes_mat = bboxes;
    detectRegions_0(nativeObj, image.nativeObj, msers_mat.nativeObj, bboxes_mat.nativeObj);
    Converters.Mat_to_vector_vector_Point(msers_mat, msers);
    msers_mat.release();
    return;
}
 
Example 7
Project: Image-Detection-Samples   File: HOGDescriptor.java   View source code 5 votes vote down vote up
public  void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold, Size winStride, Size padding, double scale, double finalThreshold, boolean useMeanshiftGrouping)
{
    Mat foundLocations_mat = foundLocations;
    Mat foundWeights_mat = foundWeights;
    detectMultiScale_0(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height, scale, finalThreshold, useMeanshiftGrouping);
    
    return;
}
 
Example 8
Project: MOAAP   File: HOGDescriptor.java   View source code 5 votes vote down vote up
public  void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold, Size winStride, Size padding, double scale, double finalThreshold, boolean useMeanshiftGrouping)
{
    Mat foundLocations_mat = foundLocations;
    Mat foundWeights_mat = foundWeights;
    detectMultiScale_0(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height, scale, finalThreshold, useMeanshiftGrouping);
    
    return;
}
 
Example 9
Project: fingerblox   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
{
    Mat objects_mat = objects;
    detectMultiScale_0(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height);
    
    return;
}
 
Example 10
Project: Sikulix2opencv   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize, boolean outputRejectLevels)
{
    Mat objects_mat = objects;
    Mat rejectLevels_mat = rejectLevels;
    Mat levelWeights_mat = levelWeights;
    detectMultiScale3_0(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height, outputRejectLevels);
    
    return;
}
 
Example 11
Project: mao-android   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights)
{
    Mat objects_mat = objects;
    Mat rejectLevels_mat = rejectLevels;
    Mat levelWeights_mat = levelWeights;
    detectMultiScale3_1(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj);
    
    return;
}
 
Example 12
Project: MOAAP   File: Objdetect.java   View source code 5 votes vote down vote up
public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold, double eps)
{
    Mat rectList_mat = rectList;
    Mat weights_mat = weights;
    groupRectangles_0(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold, eps);
    
    return;
}
 
Example 13
Project: fingerblox   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize, boolean outputRejectLevels)
{
    Mat objects_mat = objects;
    Mat rejectLevels_mat = rejectLevels;
    Mat levelWeights_mat = levelWeights;
    detectMultiScale3_0(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height, outputRejectLevels);
    
    return;
}
 
Example 14
Project: fingerblox   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights)
{
    Mat objects_mat = objects;
    Mat rejectLevels_mat = rejectLevels;
    Mat levelWeights_mat = levelWeights;
    detectMultiScale3_1(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj);
    
    return;
}
 
Example 15
Project: fingerblox   File: Objdetect.java   View source code 5 votes vote down vote up
public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold, double eps)
{
    Mat rectList_mat = rectList;
    Mat weights_mat = weights;
    groupRectangles_0(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold, eps);
    
    return;
}
 
Example 16
Project: react-native-scan-doc   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights)
{
    Mat objects_mat = objects;
    Mat rejectLevels_mat = rejectLevels;
    Mat levelWeights_mat = levelWeights;
    detectMultiScale3_1(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj);
    
    return;
}
 
Example 17
Project: Android-Code-Demos   File: MSER.java   View source code 5 votes vote down vote up
public  void detectRegions(Mat image, List<MatOfPoint> msers, MatOfRect bboxes)
{
    Mat msers_mat = new Mat();
    Mat bboxes_mat = bboxes;
    detectRegions_0(nativeObj, image.nativeObj, msers_mat.nativeObj, bboxes_mat.nativeObj);
    Converters.Mat_to_vector_vector_Point(msers_mat, msers);
    msers_mat.release();
    return;
}
 
Example 18
Project: MOAAP   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
{
    Mat objects_mat = objects;
    Mat numDetections_mat = numDetections;
    detectMultiScale2_0(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height);
    
    return;
}
 
Example 19
Project: Android-Code-Demos   File: HOGDescriptor.java   View source code 5 votes vote down vote up
public  void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights)
{
    Mat foundLocations_mat = foundLocations;
    Mat foundWeights_mat = foundWeights;
    detectMultiScale_1(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj);
    
    return;
}
 
Example 20
Project: Ftc2018RelicRecovery   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights)
{
    Mat objects_mat = objects;
    Mat rejectLevels_mat = rejectLevels;
    Mat levelWeights_mat = levelWeights;
    detectMultiScale3_1(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj);
    
    return;
}
 
Example 21
Project: android-age-estimator   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
{
    Mat objects_mat = objects;
    Mat numDetections_mat = numDetections;
    detectMultiScale2_0(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height);
    
    return;
}
 
Example 22
Project: Android-Code-Demos   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
{
    Mat objects_mat = objects;
    Mat numDetections_mat = numDetections;
    detectMultiScale2_0(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height);
    
    return;
}
 
Example 23
Project: Android-Code-Demos   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections)
{
    Mat objects_mat = objects;
    Mat numDetections_mat = numDetections;
    detectMultiScale2_1(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj);
    
    return;
}
 
Example 24
Project: renderscript_examples   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
{
    Mat objects_mat = objects;
    Mat numDetections_mat = numDetections;
    detectMultiScale2_0(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height);
    
    return;
}
 
Example 25
Project: Checkerboard-IMU-Comparator   File: HOGDescriptor.java   View source code 5 votes vote down vote up
public  void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold, Size winStride, Size padding, double scale, double finalThreshold, boolean useMeanshiftGrouping)
{
    Mat foundLocations_mat = foundLocations;
    Mat foundWeights_mat = foundWeights;
    detectMultiScale_0(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height, scale, finalThreshold, useMeanshiftGrouping);
    
    return;
}
 
Example 26
Project: MOAAP   File: Objdetect.java   View source code 5 votes vote down vote up
public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold)
{
    Mat rectList_mat = rectList;
    Mat weights_mat = weights;
    groupRectangles_1(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold);
    
    return;
}
 
Example 27
Project: Android-Code-Demos   File: Objdetect.java   View source code 5 votes vote down vote up
public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold)
{
    Mat rectList_mat = rectList;
    Mat weights_mat = weights;
    groupRectangles_1(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold);
    
    return;
}
 
Example 28
Project: Ftc2018RelicRecovery   File: Objdetect.java   View source code 5 votes vote down vote up
public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold, double eps)
{
    Mat rectList_mat = rectList;
    Mat weights_mat = weights;
    groupRectangles_0(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold, eps);
    
    return;
}
 
Example 29
Project: Team9261-2017-2018   File: Objdetect.java   View source code 5 votes vote down vote up
public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold)
{
    Mat rectList_mat = rectList;
    Mat weights_mat = weights;
    groupRectangles_1(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold);
    
    return;
}
 
Example 30
Project: OpenCV_Android_Plus   File: HOGDescriptor.java   View source code 5 votes vote down vote up
public  void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights)
{
    Mat foundLocations_mat = foundLocations;
    Mat foundWeights_mat = foundWeights;
    detectMultiScale_1(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj);

    return;
}
 
Example 31
Project: MOAAP   File: Objdetect.java   View source code 5 votes vote down vote up
public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold)
{
    Mat rectList_mat = rectList;
    Mat weights_mat = weights;
    groupRectangles_1(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold);
    
    return;
}
 
Example 32
Project: real_time_circle_detection_android   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
{
    Mat objects_mat = objects;
    Mat numDetections_mat = numDetections;
    detectMultiScale2_0(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height);
    
    return;
}
 
Example 33
Project: EyeShopping   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections)
{
    Mat objects_mat = objects;
    Mat numDetections_mat = numDetections;
    detectMultiScale2_1(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj);
    
    return;
}
 
Example 34
Project: OpenCV   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights)
{
    Mat objects_mat = objects;
    Mat rejectLevels_mat = rejectLevels;
    Mat levelWeights_mat = levelWeights;
    detectMultiScale3_1(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj);
    
    return;
}
 
Example 35
Project: MOAAP   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections)
{
    Mat objects_mat = objects;
    Mat numDetections_mat = numDetections;
    detectMultiScale2_1(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj);
    
    return;
}
 
Example 36
Project: MOAAP   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights)
{
    Mat objects_mat = objects;
    Mat rejectLevels_mat = rejectLevels;
    Mat levelWeights_mat = levelWeights;
    detectMultiScale3_1(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj);
    
    return;
}
 
Example 37
Project: Microsphere   File: MSER.java   View source code 5 votes vote down vote up
public  void detectRegions(Mat image, List<MatOfPoint> msers, MatOfRect bboxes)
{
    Mat msers_mat = new Mat();
    Mat bboxes_mat = bboxes;
    detectRegions_0(nativeObj, image.nativeObj, msers_mat.nativeObj, bboxes_mat.nativeObj);
    Converters.Mat_to_vector_vector_Point(msers_mat, msers);
    msers_mat.release();
    return;
}
 
Example 38
Project: FTC2016   File: CascadeClassifier.java   View source code 5 votes vote down vote up
public  void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
{
    Mat objects_mat = objects;
    Mat numDetections_mat = numDetections;
    detectMultiScale2_0(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height);
    
    return;
}
 
Example 39
Project: MOAAP   File: Objdetect.java   View source code 5 votes vote down vote up
public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold)
{
    Mat rectList_mat = rectList;
    Mat weights_mat = weights;
    groupRectangles_1(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold);
    
    return;
}
 
Example 40
Project: Android-Crop-Receipt   File: HOGDescriptor.java   View source code 5 votes vote down vote up
public  void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights)
{
    Mat foundLocations_mat = foundLocations;
    Mat foundWeights_mat = foundWeights;
    detectMultiScale_1(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj);

    return;
}