Cannot read image from generator
>>> import pypylon
>>> pypylon.pylon_version.version
'5.0.1.build_6388'
>>> available_cameras = pypylon.factory.find_devices()
GetDeviceDiscoveryInfo: bFunctionClass = 14, bFunctionSubClass = 3, bFunctionProtocol = 0. Device is not an U3V device.
>>> available_cameras
[<DeviceInfo Basler acA1920-25gc (21815208)>]
>>> cam = pypylon.factory.create_device(available_cameras[0])
>>> cam.opened
False
>>> cam.open()
>>> import matplotlib.pyplot as plt
>>> for image in cam.grab_images(1):
... print type(image)
...
terminate called after throwing an instance of 'GenICam_3_0_Basler_pylon_v5_0::TimeoutException'
Aborted (core dumped)
I'm using Python2, also all the Key mentioned in the README file return a KeyError
Hi @ragundez,
I see you are using an Ethernet camera. I've never tested the code myself against it, though I have a report where someone told me it works. Can you connect to the camera via Pylon viewer? If no, is the camera on the same network and pingable?
I don't have the camera now, but it is pingable and I can use the Pylon software and see the video/images.
While it should not matter, you are under Linux, right?
yes, is there a terminal output that it would be helpful to see?
No, at the moment I'm not even sure on how to approach this problem. I'll probably add some debug outputs and ask you to run it.
great, thanks a lot
Hi @mabl I fixed it, I actually cannot point out how. But know I can only read mono images, any idea why?
Because I have not implemented colour cameras yet, I have only one mono camera. Give me one one and I'll implement it :-)
If you are okay having a basic buffer without structure returned, I could to that, too. But somehow I'd love to return proper numpy arrays.
If you like, you can also try your hand implementing a proper scheme here: https://github.com/mabl/PyPylon/blob/master/cython/factory.pyx#L242
@mabl Sound like it should be easy but the GetBuffer just return one channel. There is no difference between img.GetBuffer()[:img.GetImageSize()] and img.GetBuffer() i think the initial change should be elsewhere. What do you think?
Have you changed the Camera property to Color?
no, where do i do this and what do I have to put? I think you mean intest of Mono12 in PixelFormat or not? thanks
Since I do not own a color Camera I cannot help you much. Have a look at the available entries in cam.properties and into the camera documentation. It should be somewhere.
I tried, I set the PixelFormat to YUV422Packed and other options but no success.
Packed is probably tricky to get right. What does no success mean?
still returns mono, one channel. Of course I had to remove the assert
Then I'm out of my depths.... Sorry...
no problem, thanks a lot for your time. If I figure it later I will let you know.
@mabl at the end I made my own wrapper, but just for capturing the image. You can find it in my other repository if you are interested https://github.com/rragundez/pybasler.git
@mabl, I am using acA 1920-48gc gigE color camera and i am getting following error on sample code. please help me to sort out.
for image in cam.grab_images(1): print type(image)
AssertionError Traceback (most recent call last)
D:\my_experiments\basler\PyPylon-master\cython\factory.pyx in grab_images() 222 cdef str bits_per_pixel_prop = str(self.properties['PixelSize']) 223 assert bits_per_pixel_prop.startswith('Bpp'), 'PixelSize property should start with "Bpp"' --> 224 assert image_format.startswith('Mono'), 'Only mono images allowed at this point' 225 assert not image_format.endswith('p'), 'Packed data not supported at this point' 226
AssertionError: Only mono images allowed at this point
@SubinGeorge: The current implementation only supports monochromatic cameras. Please be welcome to contribute code to get color cameras also supported.