I am capturing an image from PHP script from webcam and I want to send it to python script so that I can use OpenCV feature homography functions on it. How can I send an image using exec command in PHP and pass that image to cv2.imread() function in python? 
Thanks.
Well, I believe that if you want to use cv2.imread you need to have a file, because one of the parameters is a file name and that is going to make everythins slower and resource consuming.
I think that what you want to use is cv2.imdecode (similar to imread by in memory), in which case you only need to turn your image into the correct type of stream, a numpy array for example.
I would also consider to process everything on python at once if you want to take in account performance.
How to send a image captured from webcam in PHP to Python