“Tampilkan gambar CV2 di Jupyter Notebook” Kode Jawaban

OpenCV Show Image Jupyter

from matplotlib import pyplot as plt
import cv2

img = cv2.imread('/Users/barisx/test.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

plt.imshow(gray)
plt.title('my picture')
plt.show()
# Problem, More Help -> linkedin.com/in/barisx
Puzzled Puffin

Tampilkan gambar CV2 di Jupyter Notebook

# matplotlib interprets images in RGB format, but OpenCV uses BGR format

# so to convert the image so that it's properly loaded, convert it before loading

img = cv2.imread('filename.ext')		# this is read in BGR format
rgb_img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)		# this converts it into RGB

plt.imshow(rgb_img)
plt.show()
Uptight Unicorn

Jawaban yang mirip dengan “Tampilkan gambar CV2 di Jupyter Notebook”

Pertanyaan yang mirip dengan “Tampilkan gambar CV2 di Jupyter Notebook”

Lebih banyak jawaban terkait untuk “Tampilkan gambar CV2 di Jupyter Notebook” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya