drawMarker()를 사용하여 이미지에 제작자를 그릴 수 있습니다. org.opencv.imgproc.Imgproc 메소드 수업. 이 메소드는 다음 매개변수를 받아들입니다 -
-
이미지 − 입력 이미지를 나타내는 Mat 개체입니다.
-
위치 − Point 클래스의 개체 마커의 위치를 지정합니다.
-
색상 − 마커의 색상을 지정하는 클래스 Scalar의 개체입니다.
-
마커 유형 - 마커의 유형을 지정하는 정수 상수입니다.
-
크기 - 마커의 크기를 지정하는 정수 값입니다.
-
두께 - 마커의 두께를 지정하는 정수 값입니다.
예시
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.highgui.HighGui;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
public class DrawingMarkers {
public static void main(String args[]) throws Exception {
//Loading the OpenCV core library
System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
//Reading the contents of the image
String file ="D:\\Images\\elephant.jpg";
Mat src = Imgcodecs.imread(file);
//Preparing color and position of the marker
Scalar color = new Scalar(0, 0, 125);
Point point = new Point(150, 260);
//Drawing marker
Imgproc.drawMarker(src, point, color, Imgproc.MARKER_SQUARE, 150, 8, Imgproc.LINE_8);
HighGui.imshow("Drawing Markers", src);
HighGui.waitKey();
}
} 입력 이미지

출력
위의 프로그램을 실행하면 다음 창이 생성됩니다 -
