OpenCV in Docker? (C++)

asked 2020-08-17 08:40:44 -0600

Martian gravatar image

I've seen limited info on running OpenCV in a Docker image, perhaps because the graphics get tricky.

Does anyone have pointers to procedures for doing this?

Ideally, I'd be incorporating Qt into the build (probably same problems with graphics). But I'll settle for OpenCV as a start.

edit retag flag offensive close merge delete


but what's your actual use-case ? (gui on a serve would not make any sense, and on your local box - why docker ?

berak gravatar imageberak ( 2020-08-17 09:10:21 -0600 )edit

Hi Berak, It's a local GUI-based application. The short-term goal is simply to transport an OpenCV-based app to various Linux flavors without having to recompile OpenCV and source code. I thought that was a natural fit for Docker...until I realized that graphics could be a problem.

Longer term goal is to be able to run the same app under Windows and Mac, but that's probably wishful thinking.

I'm kind of surprised that this is not a more commonly encountered problem in Docker. Is everyone assuming that text-only interface is enough? Is there no general interest in running OpenCV in Docker?

Martian gravatar imageMartian ( 2020-08-17 22:38:01 -0600 )edit

Hey there, I am attempting to do the same thing (run in docker) using python, but not for graphics purposes but for parsing video feeds into images and passing them on to another service via mqtt. Just to make you aware, based on what you want the docker container to do, there are some libraries for headless environments. For python anyway i am using opencv-contrib-python-headless. Mabne that helps you in some way.

wil-den gravatar imagewil-den ( 2020-09-25 03:07:42 -0600 )edit

Maybe a quick solution would be to have a small web app using something like Electron that runs against a docker instance serving the video using opencv over http?

wil-den gravatar imagewil-den ( 2020-09-25 03:11:19 -0600 )edit