Photometrics / PyVCAM

Python3.X wrapper for Photometrics and QImaging PVCAM based cameras
MIT License
36 stars 17 forks source link

Issue in Live mode #40

Open puskarbudhathoki-hpi opened 10 months ago

puskarbudhathoki-hpi commented 10 months ago

Hi,

I am using this module to get live image from pvcam camera. I tried to get live images using example live-mode.py with exposure to 1. however, it just give me black screen. Any way to resolve this problem. When I run PVCAMTEST software, it can clearly read the images from camera from that setting

tomhanak commented 10 months ago

Unfortunately, we need a bit more details, at least PVCAM version and camera model to try reproducing it.

Does it throw any error? If not, what is printed in the terminal in values min, max, avg for every frame? There could be just a few bright pixels that render whole image too dark. Try to play with an exposure time or light source intensity...

puskarbudhathoki-hpi commented 9 months ago

Hi, Thank you so much for your response. The PVCAM version is 3.10.1 and the camera we are using is Leica K8. we are receiving all the frames with min, max and average value. The image we got is 16 bit, tiff image. I am not to see it using example code that is included in your wrapper. However, when I normalize it to 8 bit image and clip it, I am able to see the image. Any way to directly visualize 16 bit tiff live image?

vondrejPM commented 9 months ago

I was able to replicate similar issue with 11bit and 12bit images. Leica K8 can provide images in three bit depths. On the 200MHz port, there are three gains which are all all 11bit. On the 100MHz port, you can chose between two gains, HDR (16bit) and CMS (12bit). The HDR mode seems to work well with the cv2.imshow() call but the 11bit and 12bit needs to be normalized in order to work well with the cv2.imshow(). This can be done by calling the following:

norm_img = cv2.normalize(frame['pixel_data'], dst=None, alpha=0, beta=65535, norm_type=cv2.NORM_MINMAX) cv2.imshow('Live Mode', norm_img)