f = open('frame.png', 'rb')
rawImage = f.read()
f.close()
pilImage = Image.open(StringIO(rawImage))
npImage = np.array(pilImage)
matImage = cv.fromarray(npImage)
cv.NamedWindow('display')
cv.MoveWindow('display', 10, 10)
cv.ShowImage('display', matImage)
cv.WaitKey(0)
How to read raw png from an array in python opencv?