소스 뷰어
조회수 :   1
import cv2
import numpy as np
import matplotlib.pyplot as plt

# 이미지 읽기 (OpenCV는 기본적으로 BGR로 이미지를 불러옵니다)
img_bgr = cv2.imread('example.jpg')

# NumPy를 사용하여 BGR을 RGB로 변경
img_rgb = img_bgr[:,:,::-1]  # 채널 순서를 역으로 뒤집음 (BGR -> RGB)

# OpenCV 함수를 사용하여 BGR을 RGB로 변경
img_rgb = cv2.cvtColor( img_bgr, cv2.COLOR_BGR2RGB )

plt.imshow(img_rgb)  # BGR 이미지를 RGB로 변환하여 출력
plt.title('Exmaple OpenCV Image')
plt.axis('off')
plt.show()
No description has been provided for this image