本文整理匯總了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);
}