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


Java Imgproc.ellipse方法代碼示例

本文整理匯總了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;
}
 
開發者ID:jorenham,項目名稱:fingerblox,代碼行數:22,代碼來源:ImageProcessing.java

示例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;
}
 
開發者ID:grantslatton,項目名稱:GarfieldLanguage,代碼行數:42,代碼來源:Webcam.java

示例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);
}
 
開發者ID:ykarim,項目名稱:FTC2016,代碼行數:4,代碼來源:Drawing.java

示例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);
}
 
開發者ID:ykarim,項目名稱:FTC2016,代碼行數:4,代碼來源:Drawing.java


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