Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example for using the ThorCam? #1

Open
beniroquai opened this issue Mar 17, 2022 · 1 comment
Open

Example for using the ThorCam? #1

beniroquai opened this issue Mar 17, 2022 · 1 comment

Comments

@beniroquai
Copy link

Hey @jacopoantonello while searching for a way to interact with the USB cameras from Thorlabs, I stumbled upon your repository. I successfully compiled the code and was wondering if there is any example code get an image in python (e.g. numpy). I am not familiar with cython or c-type python bindings, unfortunately. Thanks a lot for your work! I hope to get an image in the end! :-)

@beniroquai
Copy link
Author

Never mind, your code is well structured. For those who ever need it:

from devwraps.thorcam import ThorCam
import numpy as np
import matplotlib.pyplot as plt


get_number_of_cameras
cam = ThorCam()
cam.get_number_of_cameras()
cdevices = cam.get_devices()
cam.open(cdevices[0])

texp = cam.get_exposure()
print(texp)

cam.set_exposure(5)

frame = cam.grab_image()
plt.imshow(frame), plt.colorbar(), plt.show()

Could be an example file eventually :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant