Symbolic computer vision tool with SWI-Prolog and OpenCV.
SWI-Prolog (>=7.0) compiled with
EXTRA_PKGS=cliband multi-threading enabled, better using
OpenCV4. If you installed it with
pacman -S opencvunder Archlinux, please also install
Armadillo library for matrix handling.
Machine learning library
[Optional] Qt5 if you want a moderner OpenCV displaying, complile your OpenCV with Qt option on.
cd src/ && make -j$nproc
After compilation you will get
libs folder. Simply load them in SWI-Prolog with:
load_foreign_library(foreign('libs/cvio.so')). load_foreign_library(foreign('libs/cvsampler.so')). load_foreign_library(foreign('libs/cvdraw.so')). load_foreign_library(foreign('libs/cvstats.so')).
Please see the source codes for detail predicates.
The first example is about video I/O:
?- load_foreign_library(foreign('libs/cvio.so')). ?- load_video('../../data/Protist.mp4', A), showvid_win(A, debug).
During video playing, press
ESC to quit, any other key to pause.
The second example learns ambiguity from a crater image:
cd src/learning swipl ambiguity.pl ?- a.
If the code is built, you should firstly see an image of the crater with 4 abduced theories.
The third example learns the background knowledge of lighting w.r.t. convexity for ambiguity abduction:
cd src/learning swipl light.pl ?- a('01001').
The output should be a learned logic program of lighting, however the learning is based on random samplings of low-level features, so sometime the output would be nothing. In this case, please try again.
Wang-Zhou Dai, Stephen H. Muggleton, and Zhi-Hua Zhou. Logical Vision: Meta-interpretive learning for simple geometrical concepts. In Late Breaking Paper Proceedings of the 25th International Conference on Inductive Logic Programming, pages 1–16. CEUR, 2015.
Wang-Zhou Dai and Zhi-Hua Zhou. Combining logic abduction and statistical induction: Discovering written primitives with human knowledge. In Proceedings of the 31st AAAI Conference on Artificial Intelligence (AAAI'17), San Francisco, CA, 2017.
LAMDA Group, Nanjing University
The code is protected by GPLv3.