SoFunction
Updated on 2024-11-19

jupyter notebook oepncv implementation of displaying an image

impressions

When we use jupyter notebook, we often need to visualize some things, especially some images, I here give a sample code

matrix

opencv-python
matplotlib
numpy

sample

import os
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline
img_dir='/Users/eric/Documents/data/wheel_train_val/train/non_defect/'
filename='00005.BMP_block_8.jpg'
img = (img_dir ++ filename)
(img)
()

Additional knowledge:jupyter notebook call camera cast running program

import cv2 ---- if you need to install opencv you can baidu how to install can be

cap = (0)
while(1):
  # get a frame
  ret,frame = ()
  # show a frame
  ("capture", frame)
  if (1) & 0xFF == ord('q'):
    ("./", frame)
    break
()
()

The above runs in jupyter notebook as follows

The above implementation of this jupyter notebook oepncv display an image is all that I have shared with you, I hope to be able to give you a reference, and I hope you will support me more.