mabl / PyPylon

An experimental python wrapper around the Basler Pylon 5 library
BSD 3-Clause "New" or "Revised" License
53 stars 34 forks source link

How to retrieve data chunks? #26

Open PStrasbourg opened 7 years ago

PStrasbourg commented 7 years ago

I wish to retrieve the time at which each image is acquired. I have setup the camera in order to enable chunk features. But I do not know how to retrieve the chunk data (for instance Timestamp or CounterValue). Is it do-able with the actual state of pypylon?

Below is an example code

Thanks a lot.

import pypylon as pyl import numpy as np

available_cameras = pyl.factory.find_devices() cam = pyl.factory.create_device(available_cameras[0]) cam.open()
cam.properties['ExposureTime'] = 2000 cam.properties['AcquisitionFrameRateEnable'] = True cam.properties['AcquisitionFrameRate'] = 100

cam.properties['ChunkModeActive'] = True cam.properties['ChunkSelector'] = 'Timestamp' cam.properties['ChunkEnable'] = True

index=0 for image in cam.grab_images(10): print np.mean(image)

How to retrieve Timestamp?

print cam.properties['ResultingFrameRate']

RichardLangFromNZ commented 7 years ago

Have got this working in my local repo. Will try and push my code up to github RichardLangFromNZ/PyPylon fork and let you know.

Unfortunately this root repo is starting to look like abandonware, I've had a couple of PRs outstanding for several months...

RichardLangFromNZ commented 7 years ago

OK, my latest and greatest pushed up to https://github.com/RichardLangFromNZ/PyPylon, including chunk support.