OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library, which is widely used in image processing, video processing, machine vision, artificial intelligence and other fields.
Use the cv2.imread()
function to read the image file, and the cv2.imshow()
function to display the image.
cd ~/opencv
xxxxxxxxxx
python3 01.image_read.py
Note: Select the image and press q
to exit the program!
ximport 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')