I\'m writing an OpenCV program in python, and at some point I have something like
import cv2
import numpy as np
...
img = cv2.imread(\"myImage.jpg\")
# do
If you want to write the contents as soon as the image file is being generated then you can use os.path.isfile() which return a bool value depending upon the presence of a file in the given directory.
import cv2
import os.path
while not os.path.isfile("myImage.jpg"):
#ignore if no such file is present.
pass
img = cv2.imread("myImage.jpg", 0)
cv2.imwrite("result.jpg", img)
You can also refer to docs for detailed implementation of each method and basic image operations.