Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

:)

OpenCV 그리기 함수 본문

컴퓨터비전

OpenCV 그리기 함수

mihee 2022. 3. 18. 10:02

OpenCV 주요 그리기 함수

  • 선 그리기

    • 직성 그리기 : line()
    • 화살표 그리기 : arrowedLine()
    • 마커 그리기 : drawMarker()
  • 도형 그리기

    • 사각형 그리기 : rectangle()
    • 원 그리기 : circle()
    • 타원 그리기 : ellipse()
    • 다각형 그리기 : polylines(), fillPoly()
  • 문자열 출력하기

    • 문자열 출력 : putText()
    • 출력 문자열의 크기 계산 : getTextSize()

직선 그리기

void line(InputOutputArray img, Point pt1, Point pt2, const Scalar& color, int thickness = 1, int lineType = LINE_8, int shift = 0);
  • img : 입출력 영상(Mat 타입)
  • pt1 : 시작점 좌표
  • pt2 : 끝점 좌표
  • color : 선 색상(밝기)
  • thickness : 선두께(픽셀 단위)
  • lineType : 선 타입. LINE_4, LINE_8, LINE_AA 중 하나를 지정.
  • shift : 그리기 좌표 값의 축소 비율

사각형 그리기

void rectangle(InputOutputArray img, Rect rec, const Scalar& color, int thickness = 1, int lineType = LINE_8, int shift = 0);
  • rec : 사각형 위치 정보 (x,y,w,h)
  • thickness : 음수(-1)를 지정하면 내부를 채움.

원 그리기

void circle(InputOutputArray img, Point center, int radius, const Scalar& color, int thickness = 1, int lineType = LINE_8, int shift = 0);
  • center : 원 중심 좌표
  • radius : 원 반지름

다각형 그리기

void polylines(InputOutputArray img, InoutArrayOfArrays pts, boot isClosed, const Scalar& color, int thickness = 1, int lineType = LINE_8, int shift = 0);
  • pts : 다각형 외곽선 점들의 집합 vector
  • isClosed : true 이면 시작점과 끝점을 서로 이음(폐곡선)

'컴퓨터비전' 카테고리의 다른 글

OpenCV 함수  (0) 2022.03.20
이벤트 처리하기  (0) 2022.03.19
카메라와 동영상 처리  (0) 2022.03.17
OpenCV 주요 클래스  (0) 2022.03.16
OpenCV 영상 불러와서 출력하기  (0) 2022.03.15
Comments