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.
Related
I have been searching for an answer for quite some time and I cannot figure out a robust solution: I have a C# application (on Unity) which needs to call some python functions and libraries. In particular, the python code needs to read a very large tabular file from C# -the equivalent of a large pandas dataframe-, avoiding writing and reading through a file if possible, because given the size it would reduce the performance.
I am a total beginner to C#/Unity, and I have given a look at the following workarounds:
IronPython: it is not an option because the last stable version is for python 2.7. My requirements are python 3.6 and higher, moving towards 3.8.
PyInstaller: it creates .exe files and not .dll. Moreover, it is not clear to me how you could call the executable from C# and pass a dataframe/2D array without writing it on disk. I am also not sure whether it can be called passing an entire input file as argument, if you really want to communicate via files.
Communication via socket: I am a bit lost about it. If this is really feasible on both python and Unity sides, I am happy to see your tutorials -especially for Unity!
Unity Python script editor: it works fine in dev mode. However, the python scripts cannot be included in the build. This: https://forum.unity.com/threads/python-for-unity-editor-only.914843/#post-8330904 seems very suboptimal for a stable build.
Thank you for any hint!
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.
I am teaching a class soon and I want to have users try my platform without the need of installing Python in their computers and to run everything online. I have searched for platforms such as Skulpt, CodeMirror and Trinket and they seem ok for what I want to do. However, I want to develop a GUI for the users to input parameters since there are a lot of options and I don't want users with no Python experience to run the programs from the command line like I do and hide the Python code behind the GUI. I have learnt simplegui recently but I think the GUIs you can create are not visually pleasant and for me this is a big no. I also saw in another post that using Tkinker with a in-browser python implementation is not possible.
So, I would like to know what would be the best combination of in-browser Python implementation and GUI module to reach my goal please?
Thank you so much!
I guess Jupyter could meet your needs. Getting started here.
The Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, machine learning and much more.
The Notebook has support for over 40 programming languages, including those popular in Data Science such as Python, R, Julia and Scala.
I have a webapp that is built in Rails, but I'm working with graphs and Python has far better graph libraries (namely, Graph-Tool). There are on the order of 10k lines of code written already, so it would be a hassle to switch to Django. However, the work I'm doing involves querying very, very large graphs, ones that would take a lot of time to load into the interpreter. Is there a way to have a Python interpreter somewhere that Rails controls, with actions like "Load the graph" and "search the graph for x" and "restart the interpreter"? These can be on separate computers. I've heard of the SOA solution, but I'm not sure how to set that up or if the interpreter stays open after calls from Rails. Can someone point me to some guide, or give me advice?
Right now I am using Flask with localtunnel. It works.