It took a long time. first make sure the file is in the directory and make sure that even though Windows Explorer says that the “JPEG” file is actually “JPG”. The first print statement is key to the fact that the file does exist. I am a beginner, so if the code sucks, so be it. The code simply imports the image and displays it. If the code finds the file, then True will be printed in the python window.
import cv2 import sys import numpy as np import os image_path= "C:/python27/test_image.jpg" print os.path.exists(image_path) CV_LOAD_IMAGE_COLOR = 1
source share