Pycharm, OpenCV execute on remote server and display Image locally - python

I set up PyCharm for remote debugging according to this tutorial on CodeProject
http://www.codeproject.com/Tips/987276/Remote-Programming-of-RaspberryPi-using-PyCharm
I am now wondering if it is possible to execute a Python Script with the help of PyCharm on the RaspberryPI and receive the output in PyCharm. Specifically I want to do some image processing and display the image with the help of OpenCV. It would be great to get the image displayed on my Windows machine, not on the Pi.
Another usecase, I want to create some matplot figure, execute the script on the pi and show the Output back in PyCharm on my Windows machine.
Is this possiple?
Kind Regards

You can do this using OpenCV Image Viewer Plugin. Debug you program using remote interpreter in Pycharm, stop at the breakpoint and choose "View as image".
https://plugins.jetbrains.com/plugin/14371-opencv-image-viewer
Disclaimer: I'm an author of this plugin

Related

Unable to run Pyschopy

I am trying to run Python scripts for a Brain Computer Interface Paradigm that uses Psychopy as GUI to create a visual stimuli. I am using Mac OS and the scripts are tun through the terminal I get the following message:
"This program needs access to the screen. Please run with a
Framework build of python, and only when you are logged in
on the main display of your Mac."
I am using Python 2.7 and latest version of Psychopy (http://www.psychopy.org/).
Please let me know why is this issue coming. Thanks in Advance.

How to display pygame output on cloud9-vnc?

So I'm playing with python3 on Cloud9, got interested in trying pygame and found a recommendation to install cloud9-vnc for a desktop display. Got both of those things to work, but not in tandem. I'm a rather newbish with Linux and VNC, so I'm stuck at the moment. Any chance I can get pygame output on a VNC desktop?
What I have so far is that I've installed pygame using this and cloud9-vnc using this. Pygame import and commands run smoothly (both in terminal and script) and when I run the script with c9vnc I get the link to a VNC desktop. However, the desktop is clear, apart from Ubuntu logo.
The program doesn't actually seems to be running, considering that it doesn't display the text to be printed
In fact, it seems that it's not even started to run.
However, inside the VNC desktop I have the access to complete cloud9 workspace, including installed pygame, which does work, albeit a bit more clunky, compared to cloud9's interface.
So what I want to ask is is there a way for me to write and run a code on cloud9's default interface that would directly display the output in VNC's desktop, with little to no additional interaction?

Running gimp plugins from shell on mac

I am facing some problem while trying to execute a batch plugin for gimp from shell on mac. I am using gimp 2.8.
The problem is that if i run gimp from shell, using : /Applications/GIMP.app/Contents/MacOS/gimp '(python-fu-test-hello-world)'
It will show some mesages, then batch command executed successfully
But actually nothing will happen, the code inside the python script will not run. Any special considerations needed?
Can someone shed some lights on what is going on ?
Thanks

Offline rendering of animation on server with Paraview/Python script fails

I'm running this Python script on my (Debian) server to write out an animation from vtk data:
import paraview.simple as pv
pv.servermanager.LoadState('plot.pvsm')
pv.SetActiveView(pv.GetRenderView())
pv.WriteAnimation('images/bj.png', Quality=2)
It is supposed to create this animation while I'm not logged on the server. For that I use screen and run the script with:
pvbatch --use-offscreen-rendering plot3d.py &
It does its job well by writing the image files. However, when I detach from the screen session and log out the script stops completely.
In my understanding the option --use-offscreen-rendering should make sure that no rendering on my screen happens. This works on my client machine where I can run the same script and kill the terminal and the script continues.
Maybe relevant: For every image I get the error message:
libGL error: failed to authenticate magic 1
libGL error: failed to load driver: i965
where the number after "magic" increases with each image.
My system:
Debian Linux 3.16.7-ckt11-1 (2015-05-24), kernel 3.16.0-4-amd64
Paraview 4.1.0
Python 2.7.9
Screen 4.02.01
You still need access to X server even though you're using --use-offscreen-screen flag. If you want truly offscreen, you should rebuild your ParaView with OSMesa support as described here

Pygame error "Video system not initialized" on ubuntu server with only terminal

I'm using pygame on a PC (PC-104) with ubuntu server, for this reason it only has terminal, not UI.
On my laptop the code works perfecly, running the code on the terminal "eg: python game.py", but on the PC104 it gives "Video system not initialized", I read the error is shown because it is a way to use events on a system without UI?
Thanks.
Thank for your answer jsbueno. I was able to found a solution a few weeks ago but forget to answer the question.
I wasn't able to run any pygame script with any other library than X11. But I found that one can run the script with no graphics library. Just setting the SDL_VIDEOLIBRARY enviroment variable to "dummy".
This is posible on bash but I prefer to do it on python:
os.environ["SDL_VIDEODRIVER"] = "dummy"
With this I was able to run the pygame script, detect joystick events, etc.
It is possible to run pygame programs in a system without X11 if you set it to use framebuffer or vgalib - the docs even talk about using aalib (which would display graphics using ascii art on the terminal.)
This part of the documentation has it:
Pygame will select from one of several internal display backends when
it is initialized. The display mode will be chosen depending on the
platform and permissions of current user. Before the display module is
initialized the environment variable SDL_VIDEODRIVER can be set to
control which backend is used. The systems with multiple choices are
listed here.
Windows : windib, directx
Unix : x11, dga, fbcon, directfb,
ggi, vgl, svgalib, aalib
So, what you have to do is set the SDL_VIDEODRIVER environment variable before starting your code. And being shure the proper lib. is installed.
For more information:
http://www.pygame.org/docs/ref/display.html

Categories

Resources