cv2.ellipse ()

OpenCV-Python 은 컴퓨터 비전 문제를 해결하도록 설계된 Python 바인딩 라이브러리입니다. cv2.ellipse()이 방법은 이미지에 타원을 그리는 데 사용됩니다.

cv2.ellipse(image, centerCoordinates, axesLength, angle, startAngle, endAngle, color [, thickness[, lineType[, shift]]])

매개 변수 :

  • image : 타원을 그릴 이미지입니다.
  • centerCoordinates : 타원의 중심 좌표입니다. 좌표는 (X 좌표 값, Y 좌표 값) 두 값의 튜플로 표현됩니다.
  • axesLength : 타원의 장축과 단축 (장축의 길이, 단축의 길이)을 포함하여 두 변수의 튜플을 포함합니다.
  • angle : 타원 회전 각도 (도)입니다.
  • startAngle : 타원형 호의 시작 각도 (도)입니다.
  • endAngle : 타원형 호의 끝 각도 (도)입니다.
  • color : 그릴 도형의 경계선 색상입니다. 들어 BGR , 우리는 튜플을 전달합니다. 예 : (255, 0, 0)은 파란색입니다.
  • 두께 : 모양의 경계선 두께 ( 픽셀 단위) 입니다. 두께 -1 픽셀 은 지정된 색상으로 모양을 채 웁니다.
  • lineType : 타원 경계 유형을 제공하는 선택적 매개 변수입니다.
  • shift : 이것은 선택적 매개 변수입니다. 중심 좌표의 소수점 이하 자릿수와 축 값을 나타냅니다.

반환 값 : 이미지를 반환합니다.

아래의 모든 예에서 사용 된 이미지 :

예 1 :

# Python program to explain cv2.ellipse() method  
    
# importing cv2  
import cv2  
    
# path  
path = r'C:\Users\Rajnish\Desktop\geeksforgeeks\geeks.png'
    
# Reading an image in default mode 
image = cv2.imread(path) 
    
# Window name in which image is displayed 
window_name = 'Image'
   
center_coordinates = (120, 100) 
  
axesLength = (100, 50) 
  
angle = 0
  
startAngle = 0
  
endAngle = 360
   
# Red color in BGR 
color = (0, 0, 255) 
   
# Line thickness of 5 px 
thickness = 5
   
# Using cv2.ellipse() method 
# Draw a ellipse with red line borders of thickness of 5 px 
image = cv2.ellipse(image, center_coordinates, axesLength, 
           angle, startAngle, endAngle, color, thickness) 
   
# Displaying the image  
cv2.imshow(window_name, image) 

산출:

예 2 :
-1px의 두께와 30 도의 회전을 사용합니다.

# Python program to explain cv2.ellipse() method 
    
# importing cv2 
import cv2 
    
# path 
path = r'C:\Users\Rajnish\Desktop\geeksforgeeks\geeks.png'
    
# Reading an image in default mode 
image = cv2.imread(path) 
    
# Window name in which image is displayed 
window_name = 'Image'
   
center_coordinates = (120, 100) 
  
axesLength = (100, 50) 
  
angle = 30
  
startAngle = 0
  
endAngle = 360
   
# Blue color in BGR 
color = (255, 0, 0) 
   
# Line thickness of -1 px 
thickness = -1
   
# Using cv2.ellipse() method 
# Draw a ellipse with blue line borders of thickness of -1 px 
image = cv2.ellipse(image, center_coordinates, axesLength, angle, 
                          startAngle, endAngle, color, thickness) 
   
# Displaying the image 
cv2.imshow(window_name, image) 

산출:

 

 

Matlab, Python 및 C ++ 프로그래밍, 머신 러닝, 컴퓨터 비전 이론 구현 및지도, 학부 및 석사 학위, 소금에 절인 생선 거래, 전문 답변을 알아보십시오. QQ 번호 757160542에 문의하십시오.

 

 

 


 

추천

출처blog.csdn.net/weixin_36670529/article/details/113817876