Skip to content

Instantly share code, notes, and snippets.

@yatharthb97
Created April 21, 2023 13:48
Show Gist options
  • Save yatharthb97/fda708056fbe4941b6e992d2d6582b32 to your computer and use it in GitHub Desktop.
Save yatharthb97/fda708056fbe4941b6e992d2d6582b32 to your computer and use it in GitHub Desktop.
import cv2
from vmbpy import *
import time.sleep as sleep
with VmbSystem.get_instance () as vmb:
cams = vmb.get_all_cameras ()
with cams[0] as cam:
print(cam)
for i in range(10):
frame = cam.get_frame ()
frame.convert_pixel_format(PixelFormat.Mono8)
cv2.imwrite(f'frame_{i}.jpg', frame.as_opencv_image ())
sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment