Using Docker with cv2.imshow and Mac

  1. Download and install Quartz. On newer Macs they no longer shipped with X11.
  2. Thanks to a user in the comments in this blog post I found this recipe
  3. open -a XQuartz

    ip=$(ifconfig en0 | grep inet | awk ‘$1==”inet” {print $2}’)

    xhost + $ip

    # container being used: dymat/opencv
    docker run -it –rm -e DISPLAY=$ip:0 -v /tmp/.X11-unix:/tmp/.X11-unix -v $(PWD):/drs -v $(PWD)/photo-categorization/images:/images dymat/opencv python /drs/photo-categorization/

Post Tagged with , , , , ,