Created
December 1, 2020 02:09
-
-
Save terasakisatoshi/4cd7f9f56018355f2f75d0f7da1169fd to your computer and use it in GitHub Desktop.
Try OpenCV.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DOCKER_IMAGE=terasakisatoshi/opencvjl | |
xhost +local:docker | |
docker run --rm -it \ | |
-e DISPLAY=$DISPLAY \ | |
-v /tmp/.X11-unix/:/tmp/.X11-unix \ | |
-v $(pwd):/work \ | |
--device=/dev/video0:/dev/video0 \ | |
-w /work \ | |
${DOCKER_IMAGE} \ | |
bash -c "julia script.jl" | |
xhost -local:docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using OpenCV | |
device_id = Cint(0) | |
windowname = "cvwindow" | |
cap = OpenCV.VideoCapture(device_id) | |
OpenCV.namedWindow(windowname, OpenCV.WINDOW_AUTOSIZE) | |
@info "Press q to exit" | |
while true | |
ret, img = OpenCV.read(cap) | |
if ret | |
OpenCV.imshow(windowname, img) | |
if OpenCV.waitKey(Cint(1)) & 0xFF == Int32('q') | |
OpenCV.release(cap) | |
OpenCV.destroyWindow(windowname) | |
break | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
Linux(x86_64)
machine.script.jl
andrun.sh
at your workspace.docker pull terasakisatoshi/opencvjl
.Run
bash run.sh