AttributeError: module 'cv2.cv2' has no attribute 'line'

Nunucoder·2021년 9월 4일
0

import cv2
import numpy as np

img = cv2.imread('C:/Users/leez/img/black_500.jpg')
cv2.line(img, (50,50),(150,50),(255,0,0))
cv2.line(img,(200,50),(300,50),(0,255,0))
cv2.line(img,(350,50),(450,50),(0,0,255))
#하늘색 ( 파란+초록) 10픽셀선
cv2.line(img,(100,100),(400,100),(255,255,0),10)
#분홍색(파랑+빨강) 10픽셀선
cv2.line(img,(100,150),(400,150),(255,0,255),10)
#노란색(초록+빨강) 10픽셀선
cv2.line(img,(100,200),(400,200),(0,255,255),10)
#회색(파랑+초록+빨강) 10픽셀선
cv2.line(img,(100,250),(400,250),(200,200,200),10)

cv2.imshow('lines',img)
cv2.waitKey(0)
cv2.destroyAllWindows()를 입력하세요

AttributeError: module 'cv2.cv2' has no attribute 'line'

에러 발생

pip install opencv-contrib-python

opencv만 설치했을때 위같은 에러가 발생한다.
따라서 opencv 확장팩도 같이 설치 해주도록 한다!!

profile
집에가고싶다

0개의 댓글