图像读取
图像读取1、实现原理2、实现效果3、实现代码
OpenCV(Open Source Computer Vision Library)是一个开源的计算机视觉和机器学习软件库,被广泛应用于图像处理、视频处理、机器视觉、人工智能等领域。
1、实现原理
使用cv2.imread() 函数读取图像文件,cv2.imshow() 函数显示图像。
2、实现效果
cd ~/opencv xxxxxxxxxx python3 01.image_read.py
注意:选中图片按q可以退出程序!

3、实现代码
x import cv2 def read_image(file_path): image = cv2.imread(file_path) if image is None: print("Error: Unable to open image file.") else: cv2.imshow('Image Preview', image) cv2.waitKey(0) cv2.destroyAllWindows() read_image('/home/jetson/opencv/images/yahboom_logo.png')