To use GoCV, you must install OpenCV 4.0.1 on your system.
示例代码:
This example opens a video capture device using device “0”, reads frames, and shows the video in a GUI window:
1 | package main |
编译程序,并执行
1 | go build -o test_cv gocv_example.go |
如果执行过程出现如下错误:
1 | ./test_cv: error while loading shared libraries: libopencv_calib3d.so.4.0: cannot open shared object file: No such file or directory |
解决办法:
1 | export LD_LIBRARY_PATH=/home/chengwei/work/github/opencv-4.0.1/release/lib:$LD_LIBRARY_PATH |
执行效果: