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

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

本文整理了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

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

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

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

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

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

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

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

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

  1. @Override
  2. public Result process(CvPipeline pipeline) throws Exception {
  3. if (circlesStageName == null) {
  4. return null;
  5. }
  6. Result result = pipeline.getResult(circlesStageName);
  7. if (result == null || result.model == null) {
  8. return null;
  9. }
  10. Mat mat = pipeline.getWorkingImage();
  11. List<Result.Circle> circles = (List<Result.Circle>) result.model;
  12. for (int i = 0; i < circles.size(); i++) {
  13. Result.Circle circle = circles.get(i);
  14. Color color = this.color == null ? FluentCv.indexedColor(i) : this.color;
  15. Color centerColor = this.centerColor == null ? new HslColor(color).getComplementary()
  16. : this.centerColor;
  17. Imgproc.circle(mat, new Point(circle.x, circle.y), (int) (circle.diameter / 2),
  18. FluentCv.colorToScalar(color), thickness);
  19. Imgproc.circle(mat, new Point(circle.x, circle.y), 1, FluentCv.colorToScalar(centerColor),
  20. 2);
  21. }
  22. return null;
  23. }
  24. }

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

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

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Draw circles from the current Mat contained onto the Mat specified in baseTag using the
  3. * specified color, optionally storing the results in tag. The current Mat is replaced with the
  4. * Mat from baseTag with the circles drawn on top of it.
  5. *
  6. * @param baseTag
  7. * @param color
  8. * @param tag
  9. * @return
  10. */
  11. public FluentCv drawCircles(String baseTag, Color color, String... tag) {
  12. Color centerColor = new HslColor(color).getComplementary();
  13. Mat mat = get(baseTag);
  14. if (mat == null) {
  15. mat = new Mat();
  16. }
  17. for (int i = 0; i < this.mat.cols(); i++) {
  18. double[] circle = this.mat.get(0, i);
  19. double x = circle[0];
  20. double y = circle[1];
  21. double radius = circle[2];
  22. Imgproc.circle(mat, new Point(x, y), (int) radius, colorToScalar(color), 2);
  23. Imgproc.circle(mat, new Point(x, y), 1, colorToScalar(centerColor), 2);
  24. }
  25. return store(mat, tag);
  26. }

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

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

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

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

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

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

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

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

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

  1. @Override
  2. public Result process(CvPipeline pipeline) throws Exception {
  3. Mat mat = pipeline.getWorkingImage();
  4. Mat mask = mat.clone();
  5. Mat masked = mat.clone();
  6. Scalar color = FluentCv.colorToScalar(Color.black);
  7. mask.setTo(color);
  8. masked.setTo(color);
  9. Imgproc.circle(mask, new Point(mat.cols() / 2, mat.rows() / 2), Math.abs(diameter) / 2, new Scalar(255, 255, 255), -1);
  10. if(diameter < 0) {
  11. Core.bitwise_not(mask,mask);
  12. }
  13. mat.copyTo(masked, mask);
  14. mask.release();
  15. return new Result(masked);
  16. }
  17. }

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

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

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

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

相关文章

Imgproc类方法