opencv3_java 在图像上画circle圆圈 circle

在图像上画circle圆圈 circle


package opencv_java_demo;

import org.opencv.core.*;
import org.opencv.imgcodecs.*;
import org.opencv.imgproc.*;

public class Circle {

	public static void main(String[] args) {
		System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
		
		Mat img = new Mat(400,400,CvType.CV_8UC3,new Scalar(150,150,150));
		//400*400灰色图像矩阵生成
		Imgproc.circle(img, new Point(200,200), 50, new Scalar(255,0,0));
		//200,200中心左边,半径为50,蓝色
		Imgcodecs.imwrite("./images/Circle1.jpg",img);
		
		img = new Mat(400,400,CvType.CV_8UC3,new Scalar(150,150,150));
		Imgproc.circle(img, new Point(200,200), 100, new Scalar(0,255,0),3);
		//200,200中心左边,半径为50,绿色
		Imgcodecs.imwrite("./images/Circle2.jpg",img);
		
		img = new Mat(400,400,CvType.CV_8UC3,new Scalar(150,150,150));
		Imgproc.circle(img, new Point(200,200), 150, new Scalar(0,0,255),-1);
		//200,200中心左边,半径为50,红色
		Imgcodecs.imwrite("./images/Circle3.jpg",img);
	}

}






你可能感兴趣的:(java,opencv3)