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

Can I Show preview screen when taking photos by python? #19

Open
Skullface9512 opened this issue Sep 11, 2024 · 5 comments
Open

Can I Show preview screen when taking photos by python? #19

Skullface9512 opened this issue Sep 11, 2024 · 5 comments
Labels
python python specific issue

Comments

@Skullface9512
Copy link

Hi, in python tutorials, i know that how to set some relative properties and grab images. To know that what the environment i'm grabbing, i always open the IC Capture 2.5 and it's very troublesome, can i get image data from buffer directly using python and show it by opencv

@TIS-Tim
Copy link
Contributor

TIS-Tim commented Sep 11, 2024

If you want to display an image buffer using OpenCV, you can call numpy_wrap (or numpy_copy, if the buffer's pixel format is not directly supported) on it and pass the result to imshow as shown here.

You can also create an ic4 display and manually select which buffer should be displayed on it as shown in this example.

Finally, if you happen to use Qt (PySide6) you can embed the display into your application window as shown here.

(The latter example should really be using the (new in 1.1) imagingcontrol4.pyside6.DisplayWidget, it needs an update.)

@Skullface9512
Copy link
Author

Hi, I have another problem, I need to adjust the camera's focal length through python script, do you provide some relative interface in python

@TIS-Tim
Copy link
Contributor

TIS-Tim commented Oct 10, 2024

For focal length adjustment via software you do need a zoom camera.

If you have one of those, it will be as simple as this:

grabber.device_property_map.set_value(imagingcontrol4.PropId.ZOOM, 123)

Here 123 is the logical zoom value. If you have a 39G camera, to get an approximate focal length of that number, have a look at the camera's technical reference manual.

@Skullface9512
Copy link
Author

The camera i used is DFM 37UX178-ML, can i adjust its focal length through the method you describe above.

@TIS-Tim
Copy link
Contributor

TIS-Tim commented Oct 10, 2024

No. Focal length is a hardware feature of the lens. If you want to adjust focal length via software, you need a motorized lens.

@TIS-Tim TIS-Tim added the python python specific issue label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python python specific issue
Projects
None yet
Development

No branches or pull requests

2 participants