Access webcam over internet using Python - python

I have written a program using Python and OpenCV where I perform operations on a video stream in run time. It works fine. Now if I want to publish it on a website where someone can see this using their browser and webcam, how do I proceed?

not really sure what you want to happen but if your going to implement this kind of feature in a website I think you should use a flash application instead of python (or if possible html 5). though your using python on the development of you web app it would only run on the server side instead and the feature you want to use is on a client side so for me it's more feasible to use flash instead to capture the video then after capturing the video you upload it to your server then your python code will do the rest of the process on the server side.

Related

Uploaded video process by python code on server

I have a python code on a server and if I upload a video from mobile to the server,so How can I provide path of that video to the python code if I want every video should prodceed by the python code
I have doubts that your explanation has truly reflects what you need. First of all servers accept every thing "as it is" as long as the input has the appropriate format for that specific "server". In your case, the video might be a stream, binary, or event encoded data in to a "socket" in your "server". the framework should not matter. So when you have a stream you should be able get it in to your "server" to be processed. If you have problem in that sense, you should try to look first how "servers" accept input. I assume you're knowledgable for that. Let's say you have a nginx server on a linux machine which also has a python included. So your web server should be configured to run in python (Django or something similar). Once you started to upload your file, the content can be passed as async, or sync process in python (I think I should not mention how RESTFull model work on http). When you have the data (stream or static/bulk), you should be able to whatever you want to do with that data.

How can I get the graphical output from another program?

I'm trying to build my own remote desktop which can be accessed by the browser. My first idea was building a server (with python I would use flask) and including the graphical output of the OS into my html page. Because I thought that that would be difficult/not possible my next plan is to get just the graphical output of one program which I started from the server.
Please tell me how I could do this or how I could start with this project.
This is a daunting task, but I guess this procedure would be a good start for a prototype.
Capture the display using ffmpeg:
Capturing and streaming with ffmpeg while displaying locally
Create a route to view this stream: Streaming MOVIE Python flask
Listen to click/keyboard events on the page and relay them back to source, apply these interactions using a input driver

Dim a display with a raspberry

I'm using the Pi3 and the last jessie-lite OS, and I want to manage the brightness of the screen like Kodi does with the dim screensaver.
After some google searching I found some tips but nothing works.
I'll be using an external light sensor and I want to manage the brightness proportionally at the value sent by the light sensor.
For the moment, I develop in Python2.7 but the issue can use another language or by shell.
Thank you very much!
ideally what you want would have been for the Kodi json api to support setting the screensaver, from what I understand it doesn't.
that said if your familiar with Python, and I'm not, you can develop a plug in that opens a socket (or communicates otherwise) with your program running on your pi, because from what I understand plugins have the ability to set the screensaver.
in other words, make a plug in that sends and receives message to and from the pi.
this is not really an answer because im not familiar with creating Kodi plugins, but I know it's possible because there are other plugins that do it...

Testing Adobe Analytics Instrumentation with Python

I'm attempting to automate tests of Adobe Analytics (aka Omniture) instrumentation of a web app by implementing test scripts with the Selenium Python package.
If correctly instrumented, HTTP requests are made from the browser with certain expected query parameters. Is there a Python package that would allow me to capture those outgoing HTTP requests? Right now, we do it manually with the Chrome dev tools in the Network -> Images section.
This application is also available as a native app across nearly twenty other platforms (including Smart TVs and game consoles), and I'll need to perform similar tests across those. Although, unfortunately, I won't be able to automate the script, I'd still like to capture and store the HTTP calls. I'm currently using HTTPScoop to do this manually.
I'm most comfortable with Python, but if there's a simple way of doing this in another language, I'm all ears.
I was recently working on a similar task so I can share my experience and what I've learnt on the way (rather than give you the solution).
First you need to run a proxy on your machine (e.g. http://bmp.lightbody.net/). Then I needed to run manually a few commands ( https://github.com/lightbody/browsermob-proxy#rest-api). Once the proxy was running I wrote a small script following example here https://github.com/lightbody/browsermob-proxy#using-with-selenium. Finally you simply loop over the har entries as captured on the proxy and check if an analytics request is present (you can check for URL params if needed).
I have this ready in form of a unit test for FF and Chrome (for a given URL). To be able to run this test on different devices/OS/platforms one would probably need to run the code through selenium remote webdriver https://code.google.com/p/selenium/wiki/RemoteWebDriver using service like https://www.browserstack.com/ in the cloud. I contacted them but they don't have any documentation ready but suggested I refer to online resources. That's where I am now.
Hope it helps

Communicating between appengine and an application

I'm working on a web interface which currently runs using PHP and communicates locally to a python script.
I'm moving the web side to appengine, which so far is going well when being used locally, I'm currently communicating from the appengine app to the python app via get requests that are handled by the python script.
The problem is, that obviously the machine running the python script will be behind a firewall, I've never needed to do this before and am not sure on how to implement this best.
The only idea I have so far is for the python script to send post requests to the appengine with some data and then as a response, send back some other data. The only problem with this is that the web interface should update the client quite fast.
Any ideas?
Take a look at ProtoRPC Python API: https://developers.google.com/appengine/docs/python/tools/protorpc/overview
Though it is still marked as experimental, it seems to be a decent framework for what you are trying to do - send messages back and forth between the apps.
Since you said your local app runs behind a firewall, I'm assuming you cannot open up an endpoint and protect it with some form of authentication.
Once you have messages flowing, you can either use Channel API to keep the front-end updated: https://developers.google.com/appengine/docs/python/channel/overview
Or if you want to go more basic, just implement long/short polling through AJAX.
Sorry with the limited amount of info you have provided, that's all I can think of right now. Please feel free to post more details and I'll try to help further.

Categories