本文整理汇总了Java中org.opencv.imgproc.Imgproc.ellipse方法的典型用法代码示例。如果您正苦于以下问题:Java Imgproc.ellipse方法的具体用法?Java Imgproc.ellipse怎么用?Java Imgproc.ellipse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opencv.imgproc.Imgproc
的用法示例。
在下文中一共展示了Imgproc.ellipse方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: snapShotMask
import org.opencv.imgproc.Imgproc; //导入方法依赖的package包/类
/**
* Mask used in the snapshot.
*/
private Mat snapShotMask(int rows, int cols, int padding) {
/*
Some magic numbers. We have no idea where these come from?!
int maskWidth = 260;
int maskHeight = 160;
*/
Point center = new Point(cols / 2, rows / 2);
Size axes = new Size(cols/2 - padding, rows/2 - padding);
Scalar scalarWhite = new Scalar(255, 255, 255);
Scalar scalarBlack = new Scalar(0, 0, 0);
int thickness = -1;
int lineType = 8;
Mat mask = new Mat(rows, cols, CvType.CV_8UC1, scalarBlack);
Imgproc.ellipse(mask, center, axes, 0, 0, 360, scalarWhite, thickness, lineType, 0);
return mask;
}
示例2: getFace
import org.opencv.imgproc.Imgproc; //导入方法依赖的package包/类
/**
* Detect and return a face
*
* @param frame The total webcam view. Must be in grayscale.
* @return A Mat that contains only the face
*/
public static Mat getFace(Mat frame, Mat drawFrame) {
MatOfRect faces = new MatOfRect();
// compute minimum face size (20% of the frame height)
if (absoluteFaceSize == 0) {
int height = frame.rows();
if (Math.round(height * 0.2f) > 0) {
absoluteFaceSize = Math.round(height * 0.2f);
}
}
// detect faces
faceCascade.detectMultiScale(frame, faces, 1.1, 3, 0 | CASCADE_SCALE_IMAGE,
new Size(absoluteFaceSize, absoluteFaceSize), new Size());
// each rectangle in faces is a face
Rect[] facesArray = faces.toArray();
for (int i = 0; i < facesArray.length; i++) {
Point center = new Point(facesArray[i].x + (facesArray[i].width / 2), facesArray[i].y + facesArray[i].height / 2);
Mat face = new Mat(frame, facesArray[i]);
MatOfRect eyes = new MatOfRect();
eyesCascade.detectMultiScale(face, eyes, 1.1, 2,
0 | CASCADE_SCALE_IMAGE, new Size(30, 30), new Size());
if (eyes.size().width > 0 && eyes.size().height > 0) {
Imgproc.ellipse(drawFrame, center, new Size(facesArray[i].width / 2, facesArray[i].height / 2),
0, 0, 360, new Scalar(0, 0, 0), 4, 8, 0);
}
}
return drawFrame;
}
示例3: drawEllipse
import org.opencv.imgproc.Imgproc; //导入方法依赖的package包/类
private static void drawEllipse(Mat img, Ellipse ellipse, Color color, int thickness) {
Imgproc.ellipse(img, ellipse.center(), ellipse.size(), ellipse.angle(), 0, 360, color.getScalarRGBA(), thickness);
}
示例4: drawArc
import org.opencv.imgproc.Imgproc; //导入方法依赖的package包/类
private static void drawArc(Mat img, Ellipse ellipse, Color color, double angleDegrees, int thickness) {
Imgproc.ellipse(img, ellipse.center(), ellipse.size(), ellipse.angle(), 0, angleDegrees, color.getScalarRGBA(), thickness);
}