當前位置: 首頁>>代碼示例>>Java>>正文


Java Core.MinMaxLocResult方法代碼示例

本文整理匯總了Java中org.opencv.core.Core.MinMaxLocResult方法的典型用法代碼示例。如果您正苦於以下問題:Java Core.MinMaxLocResult方法的具體用法?Java Core.MinMaxLocResult怎麽用?Java Core.MinMaxLocResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.opencv.core.Core的用法示例。


在下文中一共展示了Core.MinMaxLocResult方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getBestMatched

import org.opencv.core.Core; //導入方法依賴的package包/類
public static Pair<Point, Double> getBestMatched(Mat tmResult, int matchMethod, float threshold) {
    TimingLogger logger = new TimingLogger(LOG_TAG, "best_matched_point");
    // FIXME: 2017/11/26 正交化?
    //   Core.normalize(tmResult, tmResult, 0, 1, Core.NORM_MINMAX, -1, new Mat());
    Core.MinMaxLocResult mmr = Core.minMaxLoc(tmResult);
    logger.addSplit("minMaxLoc");
    double value;
    Point pos;
    if (matchMethod == Imgproc.TM_SQDIFF || matchMethod == Imgproc.TM_SQDIFF_NORMED) {
        pos = mmr.minLoc;
        value = -mmr.minVal;
    } else {
        pos = mmr.maxLoc;
        value = mmr.maxVal;
    }
    logger.addSplit("value:" + value);
    logger.dumpToLog();
    return new Pair<>(pos, value);
}
 
開發者ID:hyb1996,項目名稱:Auto.js,代碼行數:20,代碼來源:TemplateMatching.java

示例2: buildTemplate

import org.opencv.core.Core; //導入方法依賴的package包/類
/**
 * <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;
}
 
開發者ID:raulh82vlc,項目名稱:Image-Detection-Samples,代碼行數:54,代碼來源:EyesDetectionInteractorImpl.java

示例3: drawIrisCircle

import org.opencv.core.Core; //導入方法依賴的package包/類
public static void drawIrisCircle(Mat matrixRgba, Core.MinMaxLocResult minMaxLocResult) {
    Imgproc.circle(matrixRgba, minMaxLocResult.minLoc, 2, new Scalar(255, 255, 255, 255), 2);
}
 
開發者ID:raulh82vlc,項目名稱:Image-Detection-Samples,代碼行數:4,代碼來源:FaceDrawerOpenCV.java


注:本文中的org.opencv.core.Core.MinMaxLocResult方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。