move a stereoscopic video on the screen - python

I would like to move a (stereoscopic) video on a computer screen automatically. Think of the video as the ball in a Pong game. The problem is that it should be a stereoscopic 3D video. So the video size itself is kind of small. I did this kind of movements with pictures or drawing object, but I don't know how to do it with video material!
Does somebody know how I can do this? I already searched for video tools in python like pygame or pyglet. I have an external player Bino 3d which can open the desired video. But how can I make it move around the screen?
Or is there a tool in other programming languages like c/c++ or Matlab which can help?
By the way, the program will be on a Linux OS.
I'll be grateful for any help or hints!
Anna

I'd try to use a decent video client (mplayer, vlc). They can present the video in lots of ways, hopefully your stereoscopic issue can be solved by them.
Then I would let the client present a single window (not fullscreen) which I then would move around using window manager controls.
If you must not have window decorations around the video or if the output shall be a specific window, I think mplayer at least can be told to use an existing window to perform the output in. Maybe that's an approach then.

Related

Python Extracting Camera Video Motion Keyframes (AI tools)

I've been searching for quite some time now, but the only example I've seen where camera motion keyframes (movements) can be extracted from a video is in blender. I'm looking for a script, library, colab notebook, or any recommendation to be able input a video (for example, getting the camera keyframe movements from a video of a drone flying around) and exporting it to any type of file. The main purpose of this is double-sided: I want to be able to take the camera keyframe movements from the drone video and input it into an AI Art Animation and I want to be able to learn and add this python tool or library into a colab notebook of AI tools I've been slowly building over the months. Any help from you masterful wizards will be appreciated. Thanks!
I'm a "hacker", "novice-intermediate" level python coder, meaning I can read code and understand most basic and some advanced type coding. I'm able to read code quite well and manipulate it to my preferences, but I just don't even know where to start when it comes to the request I'm asking, ergo my post to Stack.

Python Open Source Video Player To Dynamically Play a Stream of Consecutive Videos

any help is much appreciated. I've been looking for a few days for something to meet the following use case. I need to open a single video player window which will play a dynamic stream of videos selected by an accompanying program. I'm on windows 10 but could probably find a way to use linux if needed.
So the flow would be as such:
Video 1 opens in the video player window.
On a queue sent by the same script which started the previous step, Video 1 is paused/stopped and Video 2 is played in this same window with a seamless frame to frame zero transition time.
The script in the background does some additional processing to decide whether it wants to next play Video 3, Video 4, or Video 5. Let's say the script chooses Video 5.
Now on conclusion of Video 2 we want to tell this same window to play video 5, again with seamless frame to frame zero transition or black screen.
Does anyone know how to do this? I've not been able to figure it out with python-vlc, OpenCV, or anything else! Please Help! Thanks!
I found this PyQt5 code (How to play multiple clips of a video one after another see ekhumoro's answer), which appears to play one video after another. However, the media is given to the window before calling app.exec()... How do I update the media source dynamically as the window is already open and playing media? AKA after app.exec() has been called?

Create a basic Python interface to save images drawn with a mouse

I am working on the following project and I am having really difficulties in finding the right way of doing that. I would like to build in Python (but I am open to other possibilities) a very basic interface that allows the user to draw with the mouse (or the pen if used on a surface laptop) something and then save the image. Ideally I would like this to work on a website or at least in a jupyter notebook (at least I imagine this to be utterly difficult).
Anyone can point me in the right direction? The goal would be to use the images as input to a neural network model to demonstrate its result with real life examples.
I am looking at tk but I don't seem to find much in terms of examples.
Thanks in advance, Umberto
I'd take a look at pyautogui to capture the mouse location then "draw" it in matplotlib -- should be able to do this in a loop. You'll want to watch the tkinter window size to sync the mouse coordinates with the relative location.
Why not just have your script open create a new blank img and automatically open it with paint - then read it on close? Seems easier than creating a drawing GUI.
Have a look at my Github repository which have exactly what you need.
Link : CanvasDraw Repo
Depending on the complexity you could either use tkinter which is a package for complex GUIs or something from the gaming community like pygames. You have user input and graphical output so libraries made for games will do what you want but provide way more stuff then you need. This site might help you: Drawing Libarys
Also the answere draw-on-python-tkinter-canvas-using-mouse-and-obtain-points-to-a-list might help you.

Video player creation in python

I need to create a widget that will play two synchronized (H264) videos, among other things. I have never done any GUI stuff before and would like to accomplish my goal with the least amount of work. I have two questions:
Do Tkinter or Qt have functionality that allows me play videos synchronously?
I have looked at both Tkinter and Qt and it seems there is no easy, built in, way to do so. But, then again, I am pretty unfamiliar with these systems so I could have overlooked something.
I'm not sure on the synchronous video side, but this related post may help understand more about potential limitation regarding video in tkinter
Way to play video files in Tkinter?
Hope this a helpful...gl
Qt lets you play videos using the QVideoWidget and QMediaPlayer. There's an example player for PyQt.
For Tkinter there is no default widget for playing videos. You can play videos with tkinter, but this is not using one of the tkinter widgets and a bit hackish. See this answer on stackoverflow
Synchronizing is tricky with videos, but possible. You would have to set the videos to start at the exact same time, with the same frame rate.

Selecting area of the screen with Python

I'm developing a screen shot utility in Python. At the moment it is specifically for Linux. So far I have the ability to take a screen shot of the full desktop, and have it upload to Imgur, then copy the link to clipboard. Now I want to expand into functions such as screen shots of the active window, or of a specific selection. If anyone could help, I'd love to know what kind of module would work best for this, and how to implement such a module.
The functionality will depend on what you are using for image grabbing.
With PIL
http://effbot.org/imagingbook/imagegrab.htm
With GTK
To take a screenshot of active window :
http://faq.pygtk.org/index.py?req=show&file=faq23.039.htp
Also look at the pixbuf api
http://library.gnome.org/devel/gdk-pixbuf/
http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html
Off topic
There are some screen cast tools: http://pypi.python.org/pypi/castro/1.0.4

Categories

Resources