-
Notifications
You must be signed in to change notification settings - Fork 3
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
Using Imaging Source Camera (IC4) for experiments with Python #25
Comments
The qt6-first-steps example shows how to display live video: https://github.com/TheImagingSource/ic4-examples/tree/master/python/qt6/qt6-first-steps The demoapp example expands on this to manually allow saving single images and video files: https://github.com/TheImagingSource/ic4-examples/tree/master/python/qt6/demoapp The documentation contains a section explaining how to programmatically configure camera parameters like resolution and exposure time: https://www.theimagingsource.com/en-us/documentation/ic4python/guide-configuring-device.html (frame rate is not shown there, but setting ic4.PropId.ACQUISITION_FRAME_RATE will do the trick. The easiest way to build some regular/timed image capture is probably to extend one of the Qt examples with a Qt timer. sleep will block the UI thread and make the program unresponsive. |
Hello Tim, Thank you for your quick response. I will look into these examples. The easiest way to build some regular/timed image capture is probably to extend one of the Qt examples with a Qt timer. sleep will block the UI thread and make the program unresponsive. Will this stop showing the live video and stop saving the video in the folder as well? |
Yes, rendering using ic4.pyside6.DisplayWidget requires main thread interaction. If you do time.sleep on the main thread, live display will halt. |
Then basically I will have to use Parallel Processing in Python and run this on a separate thread? |
No, just set up a timer: https://doc.qt.io/qtforpython-6/PySide6/QtCore/QTimer.html In the connected callback, do what you want to do after the time has elapsed, like capture the next image. No need to create threads. |
But will this still stop the live display and saving video to a file right? |
No, that will just register a function to be called later. The program continues on doing whatever it does. |
On a side note, if we use the Imaging Source Camera as a webcam, will there a problem like jumping frames amongst many others? Or you think it will work smoothly? |
What do you mean by "use as a webcam"? Please direct questions unrelated to ic4 to our normal support channel: https://www.theimagingsource.com/en-de/company/contact/ |
Hi, i want to know how to set white balance auto as off in python |
The Documentation explains in detail how to configure device settings. The constant for auto white balance is |
Rencently i come across some problems, i want to take photos from two devices at the same time, the method i tried is:
But it didn‘t save image and show this:
Can you give me some recommendations, thank you. |
Are you sure that TriggerMode is Off for both devices? |
Sorry i'm not set TriggerMode and i set TriggerMode like that:
the running result has no change, is there any problems. |
Can you increase the timeout (e.g. 5000)? With a frame rate that low it might take a little longer than 1 second for the first image to arrive. |
It works, thank you |
If your cameras are connected to USB3, you could also increase the frame rate to make everything go faster. Run two instances of ic4-demoapp to figure out what the maximum frame rate without frame drops is (Probably about 30 unless you changed PixelFormat). |
Hi Tim,I tried to show capture video through opencv, the mothod is:
but video is grayscale, can i set it as RGB video and how can i increase its frame rate, the device i used is DFM 37UX178-ML. |
If you create your sink with an
|
Hi Tim, today i tried to capture video, but come across a problem:
Then i tried "buffer = sink.snap_single(1000)" as "buffer = sink.snap_single(5000)", but the result has no changes, can you give me some recommendation. |
Hello!
I have been using Imaging Source camera with IC Capture for my microscopy experiments for a while now. However, now I want to automate a few things and save the new API of IC4 in Python. I will explain a few things what I want to achieve. It would be great if you could nudge me in the right directions with the examples and the documentation. I have a basic knowledge in Python. So here it goes,
I want to use the Imaging Source camera to display the live video in a window. I know I could use cv2 to show the webcam of my laptop live. What function/class should I look into to display the live video of the Imaging Source Camera on window.
In addition to point 2, I want to save this live video into a folder just as I can do in the IC Capture application. I would like to set the format, fps etc
In addition to point 2 and 3, I would like to snap an image after a set time and save it to a particular folder. Is it possible to use time.sleep() and not disrupt the live video display and saving? Because I know this is a problem when I want to use it with cv2 and the webcam.
If doing all this 3 steps in one python function is not possible, please let me know that too. This is a general description of my project but if you want more details I will give more explanation happily.
The text was updated successfully, but these errors were encountered: