Failed to create Numpy Array CVBPy Linux

Hi,

I was trying to convert a cvb.Image to a numpy array with the help of the cvb.as_array function. However I am getting a ‘RuntimeError : failed to create numpy array’ error. Here is my piece of code (which is derived from the example code PyAcquireStream.py :

import os
import cvb
import numpy



# choose your driver
device = cvb.DeviceFactory.open(os.environ["CVB"] + "/drivers/GenICam.vin")

stream = device.stream

stream.start()

image, status = stream.wait()
if status == cvb.WaitStatus.Ok:
  print("Acquired image!")
  image.save("test.bmp")
  imageNumPyArray = cvb.as_array(image,copy=True)
  print(str(imageNumPyArray))
  #cvb.WrappedImage.from_buffer(imageNumPyArray)
else:
  pass

stream.stop()

Am I doing something wrong here? What I am trying to test here is if I can reconstruct the image with the help of the numpy array. I am looking to use the WrappedImage Class once I do get the numpy array for the image. However the help file CHBPy.chm is not proving to be so helpful in this regard.

Any help would be truly appreciated. If anyone needs to take a look at the use case that I am trying to solve, please take a look at this question : CVBPy on Linux (Ubuntu 16.04). I have outlined (in a comment) what I am trying to achieve in the end.

Thanks

This bug was resolved in the latest library. Thanks :slight_smile:

2 Likes