-
Notifications
You must be signed in to change notification settings - Fork 47
Project structure
Kaiyu Yang edited this page Dec 22, 2015
·
2 revisions
OpenCV library consists of several modules: for example, we have to #include <opencv2/imgproc.hpp> in order to use the imgproc module. In our bindings, each module is to be supported with the following files:
-
./cv/<module-name>/init.luafor final Lua functions to be called by the end user -
./src/<module-name>.cppfor C functions that are called by the above Lua funcs -
./include/<module-name>.hppfor describing the corresponding .cpp file's signatures
Also, there is some common code:
-
./cv/constants.luasimply contains OpenCV constant values & enums -
./src/Common.cppand./include/Common.hppdefine wrapper structs for OpenCV classes (Mat, TermCriteria, Point, Size, ...) -
./init.luacontains data structures and methods shared by all Lua code, including Lua interfaces to structs and funcs desctibed in./src/Common.cpp
Once implemented, a <module-name> module can be used by calling
require 'cv.<module-name>'This will run ./cv/<module-name>/init.lua. Every such file also requires ./init.lua and ./cv/constants.lua for us.