import cv2
print(cv2.version)
image = cv2.imread("./test.jpg")
image2 = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
cv2.namedWindow('image')
while True:
cv2.imshow('image', image)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
実行後
error: OpenCV(4.5.1) /private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/pip-req-build-yvyj7qlp/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'
ここを参考に
https://qiita.com/Nw3965/items/5ef4bc82dd9c28e36a19
3行目を絶対パスに変更
image = cv2.imread("./test.jpg")
↓
image = cv2.imread("/Users/○○○/Desktop/test.jpg")