简体   繁体   中英

Opencv Not displaying image inside docker

I am trying to use the OpenCV imshow GUI from inside the docker container. I used the following to start the container I using nvidia-docker because, the container contains GPU version of Tensorflow

xhost +
nvidia-docker run \
--rm \
--name tf_keras \
--link mongodb_database:data_mongo \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $1:/abhijit_home \
-p 8888:8888 -p 6006:6006 \
tensorflow_gpu_v1

When I try to display am image using OpenCV I am just getting a blank screen. 在此处输入图片说明

The Image I am trying to display is displayed using matplotlib. How can I correct this? Thanks

This is probably related to matplotlib . Try

import matplotlib
matplotlib.use('Agg')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM