Add camera calibration toolchain and armor pose solver
- capture_calib: capture calibration images (MindVision / USB) with a live quality gate (Laplacian sharpness, 3x3 coverage, board auto-detect) - calibrate: batch intrinsics from calib_images/, writes configs/camera.yaml - camera_calib: CameraCalib loader (intrinsics + distortion, cached undistort remap) and solvePose() via IPPE with a reprojection gate - configs/camera.yaml: MV-SUA131GC intrinsics, RMS 0.483 px over 31 images, ruler-verified distance error < 2% - xmake: three targets sharing an rm_deps rule, C++17 - gitignore: keep calibration photos/videos and generated compile_commands.json out of the repo
This commit is contained in:
@@ -2,94 +2,44 @@ add_rules("mode.debug", "mode.release")
|
||||
|
||||
set_policy("generator.compile_commands", true)
|
||||
|
||||
set_languages("c++11")
|
||||
set_languages("c++17")
|
||||
|
||||
-- 公共依赖:OpenCV + MindVision 相机 SDK
|
||||
local ROOT = os.scriptdir()
|
||||
|
||||
rule("rm_deps")
|
||||
on_load(function (target)
|
||||
target:add("includedirs", ROOT .. "/inc")
|
||||
target:add("includedirs", "/usr/local/include/opencv4")
|
||||
target:add("includedirs", "/home/mzxiang/MindVisionSDK/include")
|
||||
target:add("linkdirs", "/usr/local/lib")
|
||||
target:add("linkdirs", "/home/mzxiang/MindVisionSDK/lib/x64")
|
||||
target:add("rpathdirs", "/home/mzxiang/MindVisionSDK/lib/x64")
|
||||
target:add("links", "opencv_core", "opencv_imgproc", "opencv_highgui",
|
||||
"opencv_imgcodecs", "opencv_videoio", "opencv_calib3d",
|
||||
"MVSDK")
|
||||
end)
|
||||
rule_end()
|
||||
|
||||
-- 主程序(自瞄本体)
|
||||
target("27RM")
|
||||
add_rules("rm_deps")
|
||||
set_kind("binary")
|
||||
add_files("$(scriptdir)/src/*.cpp")
|
||||
add_includedirs("$(scriptdir)/inc/")
|
||||
-- 各工具有自己的 main 函数,从主程序中排除
|
||||
add_files("src/*.cpp")
|
||||
remove_files("src/capture_calib.cpp")
|
||||
remove_files("src/calibrate.cpp")
|
||||
|
||||
-- openCV配置
|
||||
add_includedirs("/usr/local/include/opencv4")
|
||||
add_linkdirs("/usr/local/lib")
|
||||
add_links(
|
||||
"opencv_core",
|
||||
"opencv_imgproc",
|
||||
"opencv_highgui",
|
||||
"opencv_imgcodecs",
|
||||
"opencv_videoio")
|
||||
|
||||
-- MindVision 相机 SDK
|
||||
add_includedirs("/home/mzxiang/MindVisionSDK/include")
|
||||
add_linkdirs("/home/mzxiang/MindVisionSDK/lib/x64")
|
||||
add_rpathdirs("/home/mzxiang/MindVisionSDK/lib/x64")
|
||||
add_links("MVSDK")
|
||||
--
|
||||
-- If you want to known more usage about xmake, please see https://xmake.io
|
||||
--
|
||||
-- ## FAQ
|
||||
--
|
||||
-- You can enter the project directory firstly before building project.
|
||||
--
|
||||
-- $ cd projectdir
|
||||
--
|
||||
-- 1. How to build project?
|
||||
--
|
||||
-- $ xmake
|
||||
--
|
||||
-- 2. How to configure project?
|
||||
--
|
||||
-- $ xmake f -p [macosx|linux|iphoneos ..] -a [x86_64|i386|arm64 ..] -m [debug|release]
|
||||
--
|
||||
-- 3. Where is the build output directory?
|
||||
--
|
||||
-- The default output directory is `./build` and you can configure the output directory.
|
||||
--
|
||||
-- $ xmake f -o outputdir
|
||||
-- $ xmake
|
||||
--
|
||||
-- 4. How to run and debug target after building project?
|
||||
--
|
||||
-- $ xmake run [targetname]
|
||||
-- $ xmake run -d [targetname]
|
||||
--
|
||||
-- 5. How to install target to the system directory or other output directory?
|
||||
--
|
||||
-- $ xmake install
|
||||
-- $ xmake install -o installdir
|
||||
--
|
||||
-- 6. Add some frequently-used compilation flags in xmake.lua
|
||||
--
|
||||
-- @code
|
||||
-- -- add debug and release modes
|
||||
-- add_rules("mode.debug", "mode.release")
|
||||
--
|
||||
-- -- add macro definition
|
||||
-- add_defines("NDEBUG", "_GNU_SOURCE=1")
|
||||
--
|
||||
-- -- set warning all as error
|
||||
-- set_warnings("all", "error")
|
||||
--
|
||||
-- -- set language: c99, c++11
|
||||
-- set_languages("c99", "c++11")
|
||||
--
|
||||
-- -- set optimization: none, faster, fastest, smallest
|
||||
-- set_optimize("fastest")
|
||||
--
|
||||
-- -- add include search directories
|
||||
-- add_includedirs("/usr/include", "/usr/local/include")
|
||||
--
|
||||
-- -- add link libraries and search directories
|
||||
-- add_links("tbox")
|
||||
-- add_linkdirs("/usr/local/lib", "/usr/lib")
|
||||
--
|
||||
-- -- add system link libraries
|
||||
-- add_syslinks("z", "pthread")
|
||||
--
|
||||
-- -- add compilation and link flags
|
||||
-- add_cxflags("-stdnolib", "-fno-strict-aliasing")
|
||||
-- add_ldflags("-L/usr/local/lib", "-lpthread", {force = true})
|
||||
--
|
||||
-- @endcode
|
||||
--
|
||||
-- 标定图采集工具
|
||||
-- ./build/linux/x86_64/debug/capture_calib (MindVision 相机)
|
||||
-- ./build/linux/x86_64/debug/capture_calib --usb 0 (USB 摄像头)
|
||||
target("capture_calib")
|
||||
add_rules("rm_deps")
|
||||
set_kind("binary")
|
||||
add_files("src/capture_calib.cpp", "src/camera_set.cpp")
|
||||
|
||||
-- 标定计算工具(读 calib_images/ 算出内参,存 camera_calib.yml)
|
||||
target("calibrate")
|
||||
add_rules("rm_deps")
|
||||
set_kind("binary")
|
||||
add_files("src/calibrate.cpp")
|
||||
|
||||
Reference in New Issue
Block a user