org.opencv.imgproc.Imgproc.circle()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中org.opencv.imgproc.Imgproc.circle()方法的一些代码示例,展示了Imgproc.circle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Imgproc.circle()方法的具体详情如下:
包路径:org.opencv.imgproc.Imgproc
类名称:Imgproc
方法名:circle

Imgproc.circle介绍

暂无

代码示例

代码示例来源:origin: raulh82vlc/Image-Detection-Samples

public static void drawIrisCircle(Mat matrixRgba, Core.MinMaxLocResult minMaxLocResult) {
  Imgproc.circle(matrixRgba, minMaxLocResult.minLoc, 2, new Scalar(255, 255, 255, 255), 2);
}

代码示例来源:origin: JavaOpenCVBook/code

public void mousePressed(MouseEvent e)  
  {  
    Imgproc.circle(image,new Point(e.getX(),e.getY()),20, new Scalar(0,0,255), 4);
    updateView(image);
  }  
});

代码示例来源:origin: openpnp/openpnp

private void drawCircles(Mat mat, List<CvStage.Result.Circle> circles, int numToDraw, Color color) {
  Color centerColor = new HslColor(color).getComplementary();
  numToDraw = (numToDraw <= circles.size()) ? numToDraw : circles.size();
  for (int i=0; i<numToDraw; i++) {
    CvStage.Result.Circle circle = circles.get(i);
    double x = circle.x;
    double y = circle.y;
    double radius = circle.diameter / 2.0;
    Imgproc.circle(mat, new Point(x, y), (int) radius, FluentCv.colorToScalar(color), 2);
    Imgproc.circle(mat, new Point(x, y), 1, FluentCv.colorToScalar(centerColor), 2);
  }
}

代码示例来源:origin: openpnp/openpnp

public static Mat drawCircles(Mat mat, Mat circles) {
  for (int i = 0; i < circles.cols(); i++) {
    double[] circle = circles.get(0, i);
    double x = circle[0];
    double y = circle[1];
    double radius = circle[2];
    Imgproc.circle(mat, new Point(x, y), (int) radius, new Scalar(0, 0, 255, 255), 2);
    Imgproc.circle(mat, new Point(x, y), 1, new Scalar(0, 255, 0, 255), 2);
  }
  return mat;
}

代码示例来源:origin: openpnp/openpnp

@Override
  public Result process(CvPipeline pipeline) throws Exception {
    if (circlesStageName == null) {
      return null;
    }
    Result result = pipeline.getResult(circlesStageName);
    if (result == null || result.model == null) {
      return null;
    }
    Mat mat = pipeline.getWorkingImage();
    List<Result.Circle> circles = (List<Result.Circle>) result.model;
    for (int i = 0; i < circles.size(); i++) {
      Result.Circle circle = circles.get(i);
      Color color = this.color == null ? FluentCv.indexedColor(i) : this.color;
      Color centerColor = this.centerColor == null ? new HslColor(color).getComplementary()
          : this.centerColor;
      Imgproc.circle(mat, new Point(circle.x, circle.y), (int) (circle.diameter / 2),
          FluentCv.colorToScalar(color), thickness);
      Imgproc.circle(mat, new Point(circle.x, circle.y), 1, FluentCv.colorToScalar(centerColor),
          2);
    }
    return null;
  }
}

代码示例来源:origin: openpnp/openpnp

FluentCv.drawRotatedRect(mat, rect, thecolor, thickness);
if (drawRectCenter) {
  Imgproc.circle(mat, rect.center, rectCenterRadius, FluentCv.colorToScalar(thecolor),
      thickness);

代码示例来源:origin: raulh82vlc/Image-Detection-Samples

public static void drawFaceShapes(Rect face, Mat matrixRGBA) {
  Point start = face.tl();
  int h = (int) start.y + (face.height / 2);
  int w = (int) start.x + (face.width / 2);
  Imgproc.rectangle(matrixRGBA, start, face.br(),
      FACE_RECT_COLOR, 3);
  Point center = new Point(w, h);
  Imgproc.circle(matrixRGBA, center, 10, new Scalar(255, 0, 0, 255), 3);
}

代码示例来源:origin: JavaOpenCVBook/code

private void drawEnclosingCircle(MatOfPoint currentContour) {
  float[] radius = new float[1];
  Point center = new Point();
  
  MatOfPoint2f currentContour2f = new MatOfPoint2f();
  currentContour.convertTo(currentContour2f, CvType.CV_32FC2);
  Imgproc.minEnclosingCircle(currentContour2f, center, radius);
  
  Imgproc.circle(image, center, (int) radius[0], new Scalar(255,0,0));
  
}

代码示例来源:origin: openpnp/openpnp

if (coords.length == 3) {
  Imgproc.circle(mask,
      new Point(Integer.parseInt(coords[0]), Integer.parseInt(coords[1])),
      Integer.parseInt(coords[2]), new Scalar(255, 255, 255), -1);

代码示例来源:origin: openpnp/openpnp

Imgproc.circle(mask, new Point(circle.x, circle.y), (int) circle.diameter / 2,
    new Scalar(255, 255, 255), -1);
    Imgproc.circle(mask, new Point(circle.x, circle.y), (int) circle.diameter / 2,
        new Scalar(255, 255, 255), -1);

代码示例来源:origin: openpnp/openpnp

/**
 * Draw circles from the current Mat contained onto the Mat specified in baseTag using the
 * specified color, optionally storing the results in tag. The current Mat is replaced with the
 * Mat from baseTag with the circles drawn on top of it.
 * 
 * @param baseTag
 * @param color
 * @param tag
 * @return
 */
public FluentCv drawCircles(String baseTag, Color color, String... tag) {
  Color centerColor = new HslColor(color).getComplementary();
  Mat mat = get(baseTag);
  if (mat == null) {
    mat = new Mat();
  }
  for (int i = 0; i < this.mat.cols(); i++) {
    double[] circle = this.mat.get(0, i);
    double x = circle[0];
    double y = circle[1];
    double radius = circle[2];
    Imgproc.circle(mat, new Point(x, y), (int) radius, colorToScalar(color), 2);
    Imgproc.circle(mat, new Point(x, y), 1, colorToScalar(centerColor), 2);
  }
  return store(mat, tag);
}

代码示例来源:origin: us.ihmc/IHMCPerception

Imgproc.circle(openCVColoredCircularBlobDetector.getCurrentCameraFrameMatInBGR(), openCVPoint, (int) circle.getRadius(), circleColor, 1);
Imgproc.circle(openCVColoredCircularBlobDetector.getThresholdMat(), openCVPoint, (int) circle.getRadius(), circleColor, 1);

代码示例来源:origin: us.ihmc/ihmc-perception

Imgproc.circle(openCVColoredCircularBlobDetector.getCurrentCameraFrameMatInBGR(), openCVPoint, (int) circle.getRadius(), circleColor, 1);
Imgproc.circle(openCVColoredCircularBlobDetector.getThresholdMat(), openCVPoint, (int) circle.getRadius(), circleColor, 1);

代码示例来源:origin: us.ihmc/ihmc-humanoid-behaviors

Point openCvCenter = new Point(vecCenter.getX(), vecCenter.getY());
int circleRadius = (int) circles.get(i).getRadius();
Imgproc.circle(openCVColoredCircularBlobDetector.getCurrentCameraFrameMatInBGR(), openCvCenter, circleRadius, circleColor, 1);
Imgproc.circle(openCVColoredCircularBlobDetector.getThresholdMat(), openCvCenter, circleRadius, circleColor, 1);

代码示例来源:origin: us.ihmc/IHMCHumanoidBehaviors

Point openCvCenter = new Point(vecCenter.getX(), vecCenter.getY());
int circleRadius = (int) circles.get(i).getRadius();
Imgproc.circle(openCVColoredCircularBlobDetector.getCurrentCameraFrameMatInBGR(), openCvCenter, circleRadius, circleColor, 1);
Imgproc.circle(openCVColoredCircularBlobDetector.getThresholdMat(), openCvCenter, circleRadius, circleColor, 1);

代码示例来源:origin: openpnp/openpnp

@Override
  public Result process(CvPipeline pipeline) throws Exception {
    Mat mat = pipeline.getWorkingImage();
    Mat mask = mat.clone();
    Mat masked = mat.clone();
    Scalar color = FluentCv.colorToScalar(Color.black);
    mask.setTo(color);
    masked.setTo(color);
    Imgproc.circle(mask, new Point(mat.cols() / 2, mat.rows() / 2),  Math.abs(diameter) / 2, new Scalar(255, 255, 255), -1);
    if(diameter < 0) {
      Core.bitwise_not(mask,mask);
    }
    mat.copyTo(masked, mask);
    mask.release();
    return new Result(masked);
  }
}

代码示例来源:origin: JavaOpenCVBook/code

int radius = (int) Math.round(circles.get(0, i)[2]);
Imgproc.circle( image, center, radius, new Scalar(0,255,0),3);//radius, color)

代码示例来源:origin: JavaOpenCVBook/code

Imgproc.circle(originalImageAnnotated, srcPoints[i], 4, new Scalar (255.0,0,0),-1);

相关文章

微信公众号

最新文章

更多

Imgproc类方法