Im working of a project in python that is intended to be as modular and flexible as possible. The project must to be written in Python, and it involves some image processing (access to individual pixels and image size).
what would be the best way to manipulate an image in Python without the use of external libraries? I am trying to use as little dependancies as possible, so it will be easy to transfer to different platforms.
I would appreciate any other approaches that might work better.
Well I can understand your concern I myself had a similar problem when i did a project on image processing and i had to port it to nanoboard(FPGA) so using external libraries is much of a headache.
What i did was, first programmed the code using the libraries at hand and then looked up for their implementation. You can view the source code for functions in python and they could be used with a little modifications. Hope it helps. Reach me for any furthur queries.
Related
I recently stumbled upon an SO question that pointed at using WinRT (discontinued in Python 3.10), that helps handle Windows Runtime APIs. I wanted to use it to develop a basic desktop overlay that shows a list of currently running audio sources (primarily, Spotify). I did accomplish everything else, concering the UI and such, using tkinter.
The main problem is that the support for Python WinRT discontinued for the 3.10 version, (and onwards), and I can not find libraries that might substitute it. The main solutions I find include downgrading to Python 3.9 (or, using a venv, which sounds better), or just using a community fork (PyWinrt), but I'm not really putting these hacks or workarounds at a priority, I might be willing to opt for these if there is no other possible solution.
Is it still possible to develop such an overlay using only Python? Since I'm using Tkinter, all i would need is an image of the current playing track, the application that is running it, progress in the audio (in ms or s), and the name of the track. Keeping it simple, I'm trying to avoid audio control, such as skipping the track, or changing the relative timestamp.
I did try using the Spotify WebAPI to specifically grab info related to the track currently playing, but the work involved with refresh oauth tokens, and creating logins for just looking at the track seems a bit much work, since I believe it would be easier done natively; plus, what I'm trying to aim for, is a general purpose audio source info, rather than just Spotify.
Here, is a picture of Windows' Gamebar, that shows what I'm trying to achieve:
GamebarOverlay.
I am developing a solution using a comercial computer vision software called Halcon. I am thinking on migrating or convert my solution to OpenCV in Python. I will like to start developing my other computer vision solution in Halcon because the IDE is incredible, and them generate a script to migrate them to OpenCV.
Does anyone know any library for this task?
I will like to start developing an open source SDK to convert Halcon to OpenCV. I and thinking to start developing all internal function from Halcon to Python. Any advice?
I wouldn't invest time in such an effort. These are some reasons:
For simple functions (blur, erode, dilate) Halcon and OpenCV have different implementations of the same function and probably you will have slightly different outputs (one may round up and the other round down, for example). A complex program that runs properly in Halcon may fail in OpenCV for these small differences (a butterfly effect).
Probably there are complex functions (pattern matching algorithms, deep learning), that exist in one environment and don't exist in the other.
OpenCV users typically don't have Halcon IDE. I like OpenCV because it is open source and free, I won't consider using Halcon IDE because it is not. Moreover OpenCV has many functions and it improves very fast (I don't know Halcon). If Halcon was much better than OpenCV (more popular, faster, cross platform, with all OpenCV functions implemented in Halcon) and my project had the money, I would use Halcon IDE for development and I would use it in production as well (and completely ignore OpenCV). In either case, I wouldn't use a tool that converts one to the other. It is like writing the Linux kernel with Visual Studio, maybe someone does it, but I guess it is not the majority.
If I had to spend time in an open source project, I would write a better OpenCV interface (as Vladimir Perković suggests). There are some efforts in that direction (probably there is something else if you search):
Interactive Visual Debugging: https://docs.opencv.org/3.3.0/d7/dcf/tutorial_cvv_introduction.html I haven't tried that, but I have written and used similar tools in the past and is usually enough.
Debug images in Visual Studio: https://docs.opencv.org/2.4/doc/tutorials/introduction/windows_visual_studio_image_watch/windows_visual_studio_image_watch.html
What I really want to see some day is a visual programming language editor, where you drag and drop boxes and connect them (like in a flowchart). Something similar to LabVIEW, VPL, but open source and for OpenCV.
It looks like the future (or the present) is web based, and there are many flowchart programming tools that are open source like Node-Red, No-Flo UI or Apache NiFi. Probably you can modify them to use OpenCV functions (a quick search returns this and this)
Blender is a 3D editor (with a video editor and many other features) that you can program in python and also has a flowchart programming language ("Compositing Nodes"). I don't see a better place to integrate OpenCV!
It depends on which Halcon functionalities are you using and why you want to do it. The question appears to be very general. I would recommend you to convert your Halcon Program to C++ and write a wrapper function to pass arguments to/from your openCV program.This would be the simplest option to provide interaction between your opencv and halcon program. Hope it helps.
This is unfortunately not possible because Halcon itself is not an open source library and every single function is locked.
The reason behind is runtime licencing.
What are some libraries in Python that have the ability to read CT model files with extensions such as .vtk or .stl and perform 3D image registration with normal videos. I have found many softwares that have this ability but what I am looking for is not a program but a Python library such as Numpy or OpenCV, where all I need to do is import numpy or import cv2.
Made up example of what I want to do
Step 1 - Get the 3D CT model of a person's skull
Step 2 - Read the 3D CT model into Python
Step 3 - Get a normal video of a person standing still
Step 4 - Perform registration of the 3D CT skull and
person's head from the normal video
Step 5 - Display the registration output
I have found a couple of Python libraries that "seem" to do this sort of thing but they do not have enough information in the library description to be sure that this is what I want. I am also open to using multiple libraries. Is there anyone who has done something similar to this and it would be great if someone with experience with any libraries could give me some recommendations, thanks. If there aren't any, I will also consider libraries in other languages.
What I have considered so far
FW4SPL Libarary in C++
MITK Library in C++
MeVisLab Software in Python
Elastix Library in C++
SimpleElastix Library in Python
ITK Library in C++
SimpleITK Library in Python
For FW4SPL and MITK, I have been unable to successfully compile the source code due to new errors continuously occurring after debugging old errors. It seems that the occurrence of new errors will not stop occurring (I have spent a lot of time doing this and do not wish to continue anymore).
For MeVisLab, this is not a Python library such as numpy or opencv but it is a GUI which is also said to be programmable.
For Elastix, SimpleElastix, ITK and SimpleITK, they are indeed C++ and Python libraries which seem perfect but I am not sure if they provide the requirements of my application described above. Also, I am very confused about the relationship to one another.
I am playing with vtk and stl files for the first time. Your question drove me curious but I am clearly not experienced. I started looking into this before the above comment. I did not realize we were off-topic, sorry. So I give you my conclusions at this point, since there were built for sharing.
1) for .vtk files
It turns out that most of the library I saw are for python 2.7 while I prefer the up to date version (3.5 for now).
For 3.5 I finally adopted the version of ‘woodscn’ that seems promising, for coding it seems to me all the required info is on Reading a .vtk file with python
2) for .stl files
the ‘nestly’ package from 'conda-forge’ looks good, with a typical example on https://github.com/fhcrc/nestly/blob/master/examples/basic_nest/make_nest.py
then you just have to write import vtk and import nestly in the python script.
hope this helps
Hi I have a MATLAB function that graphs the trajectory of different divers (the Olympic sport diving) depending on the position of a slider at the bottom of the window. The file takes multiple .mat files (with trajectory information in 3 dimensions) as input. I am trying to put this MATLAB app on to the internet. What would be the easiest/most efficient way of doing this? I have experience programming in Python and little experience programming in Java.
Here are the options that I have considered:
1. MATLAB Builder JA (too expensive)
2. Rewrite entire MATLAB function into Java (not experienced enough in Java)
3. Implement MATLAB file using mlabwrapper and using Django to deploy into web app. (having a lot of trouble installing mlabwrapper onto OSX)
4. Rewrite MATLAB function into Python using SciPy, NumPy, and matlibplot and then using Django.
I do not have any experience with Django but I am willing to learn it. Can someone point me in the right direction?
A cheap and somewhat easy way (with limited functionality) would be:
Install MATLAB on your server, or use the MATLAB Compiler to create a stand alone executable (not sure if that comes with your version of MATLAB or not). If you don't have the compiler and can't install MATLAB on your server, you could always go to a freelancing site such as elance.com, and pay someone $20 to compile your code for you into a windows exe file.
Either way, the end goal is to make your MATLAB function callable from the command line (the server will be doing the calling) You could make your input arguments into the slider value, and the .mat files you want to open, and the compiled version of MATLAB will know how to handle this. Once you do that, have the code create a plot and save an image of it. (using getframe or other figure export tools, check out FEX). Have your server output this image to the client.
Tah-dah, you have a crappy low cost work around!
I hope this helps , if not, I apologize!
You could always just host the MATLAB code and sample .mat on a website for people to download and play with on their own machines if they have a MATLAB license. If you are looking at having some sort of embedded app on your website you are going to need to rewrite your code in another language. The project sounds doable in python using the packages you mentioned however hosting it online will not be as simple as running a program from your command line. Django would help you build a website but I do not think that it will allow you to just run a python script in the browser.
I'm trying to create a means to display QR codes on a small display using a Telit GE-865 as the main controller. In short, the Telit would receive an sms and spin that string out to a display in the form of a QR code. I've found a few different python QR code library's (most from the fukuchi ports), but I'm not exactly sure if they can be imported into a Telit module. If anyone has any experience running python on the Telit modules I'd love to hear your experience and get your thoughts on whether this is feasible or not.
Thanks in advance!
Yes, sorry. Forgot to elaborate a bit. My specific concern is that the scripts Telit provides for examples reference a 1 version of Python. Everything in the QR Encoding library that I've been finding usually require 2.6 or later. I'm not sure if the Telit module can handle a QR encoding script or not with it's PIL library. I'm really just trying to wrap my head around it all before I start figuring out how to actually load the libraries onto the module. I also found this site that seems to have a decent amount of info on this topic. link – user1667373
This device uses a customized version of Python 1.5.2. You may need to back-port whatever library to are using to work with this older version of Python. Note also that not all standard Python modules are available, and floating point math is not supported.
See section 5 of the "Telit Easy Script in Python" manual for details of what is and is not included. You can find it here: http://www.telit.com/en/products/gsm-gprs.php?p_id=12&p_ac=show&p=47