Spinnaker sdk convert image to Opencv format Python

1.9k views Asked by At

i have a Flir A615 camera and im getting data from it with this code:

image_result = cam.GetNextImage()
image_data = image_result.GetNDArray()

then to show im using matplotlib

plt.imshow(image_data, cmap='afmhot')

but i cant use it on opencv like

cv2.imshow("frame",image_data)

some one know how to convert the PySpin.Image to Opencv format?

1

There are 1 answers

0
Lucas Sabbatini On

The PySpin image.GetNDArray method converts and returns the image to a numpy array. In this answer you can find the conversion rules for numpy -> opencv format: Converting Numpy Array to OpenCV Array