本文整理汇总了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);
}
示例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;
}
示例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);
}