Tuesday, September 22, 2015

Raspberry Pi + Python/OpenCV, load and display image


Example of Python run on Raspberry Pi 2 to load and display image using OpenCV 2:
import sys
import cv2

print("Python version: \n" + sys.version)
print("cv2 version: " + cv2.__version__)

img = cv2.imread('smallRPi.JPG', cv2.IMREAD_UNCHANGED)
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyWindow('image')




No comments: