선과 텍스트를 그리기 위해 다음과 같은 코드를 사용할 수 있습니다.
Point firstPoint = new Point(100, 200);
Point secondPoint = new Point(100, 400);
Point middlePoint = new Point(firstPoint.x,
firstPoint.y + 0.5 * (secondPoint.y - firstPoint.y));
Scalar lineColor = new Scalar(255, 0, 0, 255);
int lineWidth = 3;
Scalar textColor = new Scalar(255, 0, 0, 255);
Imgproc.line(sourceMat, firstPoint, secondPoint, lineColor, lineWidth);
Imgproc.putText(sourceMat, " Text" , middlePoint,
Core.FONT_HERSHEY_PLAIN, 1.5 , textColor);
어디 sourceMat
- Mat
이미지.
그리고 선 "높이"를 cm 단위로 결정하려면 (대략) 배터리 직사각형의 "높이"를 사용해야합니다.
lineHeightCm = 4.46 / heightOfBatteryRectangleInPixels * lineHeightInPixels;
여기서 4.46-AAA 배터리의 "높이"(cm).
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다