Deploying Flask based OpenCV application on Heroku PaaS

asked 2018-07-03 13:56:59 -0500

Hi,

I have a simple Face Detection application developed using Flask and OpenCV, and is working fine on my local machine (laptop) because it is using my laptop's camera for capturing images.

When I deployed this app in Heroku server, the application was built and deployed successfully but it fails to identify the client side camera, when invoked using the browser, though I changed the port to 0.0.0.0.

Seems it is trying to invoke the Heroku Server's camera instead of identifying my laptop's camera.

Application URL: https://faceeyesdetector.herokuapp.com/ Github URL: https://github.com/socratesk/FaceEyeD...

Please let me know what configuration should I change so that it works on my local machine, while deployed on to Heroku server.

Thanks!

edit retag flag offensive close merge delete

Comments

did you really expect a python script running VideoCapture(0) on the server will open a client's webcam ? that's entirely the wrong concept.

one way to do this is to serve html/js, that invokes the client's cam via js in the browser (and maybe also runs the facedetection locally, using e,g, picojs, then sends results back to your server)

berak gravatar imageberak ( 2018-07-03 19:32:04 -0500 )edit

you also could use opencv.js for this task

berak gravatar imageberak ( 2018-07-03 22:57:58 -0500 )edit