This isn't a question per se, rather a couple things I have learned while trying to write a Python script to interface with a ThorLabs USB 3.0 digital camera.
I tried a few different drivers (uEye, flycapture2, etc) and found that the uc480 driver was the easiest to use and most reliable one. However, I found it to be a bit tricky to get working properly. I used the import statement from instrumental.drivers.cameras import uc480 to import it into my code. Whenever ThorLab's "ThorCam" software was installed and working properly, this worked no problem. (This software can be found on Thorlab's website: https://www.thorlabs.com/software_pages/ViewSoftwarePage.cfm?Code=ThorCam). However, I found that often, ThorLabs would be installed, but unable to interface with the camera. When this was the case, the uc480 driver would be unable to find any available cameras. This is what I found worked to fix that problem:
If ThorCam can't find the camera and the light on the camera is red, uninstall and reinstall ThorCam, then restart the computer and try again. If the light is red on the camera, I believe this means that the camera is unable to interface with the computer, so uninstalling and reinstalling ThorCam should fix whatever driver issue is causing this.
If ThorCam can't find the camera and the light on the camera is green, this means the camera is probably interfacing with an alternative software. In particular, I found uEye from IDS to be particularly bad about interfacing with the camera and not allowing ThorCams to connect. If this is the case, you can either switch to using uEye using from pyueye import ueye (though I personally would not recommend this as I found uEye a lot more difficult to use compared to uc480), or delete the IDS software and restart your computer. I also tried using pylablib instead to get the camera to choose which software to interface with, but I did not have any luck. (If you want to try for yourself, here's a link to some documentation: https://pylablib.readthedocs.io/en/latest/devices/uc480.html#operation). If this still doesn't work, try deleting other camera interfacing softwares (such as Spinnaker, FlyCapture, or Flir), restarting your computer, and seeing if ThorCam can now find your camera. This worked for me.
You can check if uc480 is able to find your camera in python using uc480.list_instruments().
If anyone has any more refined ways of solving these issues, or additional tips, please add them!
Related
I'm looking to connect my DSLR (Canon T3i) - and generally any DSLR - for use with opencv-python. I'd ideally like to be able to do it via Windows or Linux. I've seen libgphoto2 mentioned (on the linux side) but have not found a general enough post on and forums to explain how to get opencv to recognize a connected DSLR via the "cv2.VideoCapture(camera_id)"
Does anyone know how this is accomplished?
I want to make a program in python that can keep track of what tabs the user has open in their browser (Chrome, IE and Microsoft Edge, but preferably all browsers), however, after doing a bit of research I have been unable to find any modules that will enable this. Can anyone point me in the right direction as far as a module goes?
For anyone wondering I want to keep track of the time spent running this tab, so the user can see what programs they have run throughout the day. Thanks in advance!
I don't think there's a single module that does that. You will have to create/use for each browser. Futhermore it will likely be operating system specific.
For example for Chrome (or any other browser) on OSX you will like you the AppleScript interface wrapping it around Python or using MacPython OSA
I am not familiar with Linux or Windows, but I bet there should be a similar way.
I'm developing a Sublime Text plugin to work with IoT devices. Some of that hardwares have the option to upload the code by OTA (over the air) and I need to be able to discover the device by mDNS.
I've tried with zeroconf and it works very well, I just need to set the browser like that:
browser = ServiceBrowser(zeroconf, "_arduino._tcp.local.", listener)
So, what is the problem?
Sublime Text runs the plugins in it's own simplified version, so the only way to run an external package is downloading and integrating it into the plugin code. all is fine there, I've done with other packages without problem.
zeroconf has the following dependencies: enum-compat, netifaces, six and some of that dependencies has its own dependencies.
I tried downloading each dependency (and it seems to much code only to browse), but the main problem is that netifaces is written in C. I tested some things to try to make it work but I didn't make it.
I've also tried with this repository zeroconf It's and old version of the zeroconf above and not need the netifaces dependence. The code to browse is the same in both cases, but in this old version it's not getting any arduino device.
So what do I need?
I would like to get help with a code to browse/discover the arduino devices, as I previously described the main goal is get a minimum code to this task and run without install any dependence. I mean download the depedence if it needs and execute it locally.
I don't want someone to write me the code, but someone to may point me where can I start.
I've been looking the zeroconf code and it seems that it's not possible to work without netifaces, and that is the reason why the old repository didn't find the devices.
I've also tried with:
mdns This seems to be a non dependence code, but there is not documentation, so I didn't make it work
mdns-lookup It find other devices, but not the arduino/esp type
I'm trying to capture my screen using Python because I'll use it on OpenCV, but I couldn't find a way to make it work on Gnome, since Gnome uses Wayland and all libraries that I've found only work with X11.
For now I'm not considering change my interface. I'm searching a solution to this problem.
Does someone know a solution?
To be more specific, I'll use the images to train an AI and so I need they continuously.
EDIT:
I've found this but how can I pass frames to OpenCV in Python instead of save a video file?
The proper way to do screencasting these days is by using the Screencast portal, which is part of XDG desktop portals and is already supported by GNOME, KDE, wlroots (and more). As an added advantage, this will also work in containerized formats like Flatpaks.
You can find an example on how to do screencasting in Pyhon using this snippet, created by one of the Mutter maintainers. If you look for parse_launch(), you will see a GStreamer pipeline which you can modify to include the GStreamer OpenCV elements that can do the processing for you.
Note: in your edit, you link to a predecessor of that portal, which is GNOME-specifc, internal API, so I wouldn't rely on it ;-)
I'm wondering is that possible to control lights connected to Enttec Open DMX USB via Python shell. If it is, how to?
The Open Lighting Project (formerly known as opendmx) provides a Python API, as part of their Open Lighting Architecture (OLA), for use the OpenDMX USB on OSX and Linux. If you're on Windows then I've not found anything apart from the code from Enttec's website which uses the FTD2XX.DLL libraries.
However it should be noted that one cannot use normal serial based libraries (pyserial etc). Basically OLA either needs to use a special kernel module on Linux, or use the generic FTDI non-serial kernel driver in combination with libftdi on Mac or Linux - for details see their device specific page. There is now pre-built support for Raspberry Pi's on the OLA website.
The communication and protocols used are completely different from Enttec Pro range (which one can just control using simple serial commands with something like pyserial, though OLA also talks to them too).
I know this is quite an old post, however DmxPy has worked very well for me the last few months. It only works for Python 2 but I know there's some Python 3 ports out there.
It's stupid simple to use. I personally use it in my companies quality control software. While it only work for DMX (not RDM) I think it's much easier to use than OLA's Python Wrapper. It works flawlessly with our ENTTEC as well!
UPDATE: Here's my Python 3 port: https://github.com/trevordavies095/DmxPy
I had the exact same problem, so I wrote a simple python programm for all those that are running windows; have a look: https://github.com/Coronon/PyOpenDmxUsb
It uses a C# Server (Because their C# interface was the only one that worked for me) and a Python Client and is super easy to use.
It is compatible with the non pro version too. (The Pro Version is way easier to use and I would use the AcceptedAnswer instead [But the normal one isnt supported])
Edit: This may be 'advertisement' but my project is Open-Source and super easy to use, so I believe this can be useful to others :)