|
@@ -1,96 +1,21 @@
|
|
|
#include "app_debug.h"
|
|
#include "app_debug.h"
|
|
|
-#include "GLFW/glfw3.h"
|
|
|
|
|
|
|
+#include "core/math_helper.hpp"
|
|
|
|
|
+#include "module_v5/algorithms/algorithms.h"
|
|
|
|
|
|
|
|
-#include <opencv2/imgcodecs.hpp>
|
|
|
|
|
-#include <opencv2/cudastereo.hpp>
|
|
|
|
|
-#include <opencv2/cudaimgproc.hpp>
|
|
|
|
|
-
|
|
|
|
|
-//app_debug::app_debug(const create_config &conf) {
|
|
|
|
|
-//
|
|
|
|
|
-// auto left_path = "/home/tpx/project/DepthGuide/cmake-build-debug/Left.png";
|
|
|
|
|
-// auto right_path = "/home/tpx/project/DepthGuide/cmake-build-debug/Right.png";
|
|
|
|
|
-//
|
|
|
|
|
-// auto left_img = cv::imread(left_path);
|
|
|
|
|
-// auto right_img = cv::imread(right_path);
|
|
|
|
|
-//
|
|
|
|
|
-// auto left_img_cuda = cv::cuda::GpuMat();
|
|
|
|
|
-// auto right_img_cuda = cv::cuda::GpuMat();
|
|
|
|
|
-//
|
|
|
|
|
-// left_img_cuda.upload(left_img);
|
|
|
|
|
-// right_img_cuda.upload(right_img);
|
|
|
|
|
-//
|
|
|
|
|
-// // covert to gray
|
|
|
|
|
-// cv::cuda::cvtColor(left_img_cuda, left_img_cuda, cv::COLOR_RGB2GRAY);
|
|
|
|
|
-// cv::cuda::cvtColor(right_img_cuda, right_img_cuda, cv::COLOR_RGB2GRAY);
|
|
|
|
|
-//
|
|
|
|
|
-// auto disparity_cuda = cv::cuda::GpuMat();
|
|
|
|
|
-// auto stereo = cv::cuda::createStereoSGM();
|
|
|
|
|
-// stereo->setNumDisparities(128);
|
|
|
|
|
-//// stereo->setMode(cv::StereoSGBM::MODE_HH);
|
|
|
|
|
-// stereo->compute(left_img_cuda, right_img_cuda, disparity_cuda);
|
|
|
|
|
-//
|
|
|
|
|
-// auto filter = cv::cuda::createDisparityBilateralFilter();
|
|
|
|
|
-// filter->setNumDisparities(128);
|
|
|
|
|
-// filter->setRadius(5);
|
|
|
|
|
-// filter->setNumIters(3);
|
|
|
|
|
-// filter->apply(disparity_cuda, left_img_cuda, disparity_cuda);
|
|
|
|
|
-//
|
|
|
|
|
-// auto disparity = cv::Mat();
|
|
|
|
|
-// disparity_cuda.download(disparity);
|
|
|
|
|
-//
|
|
|
|
|
-// double min_val, max_val;
|
|
|
|
|
-// cv::minMaxLoc(disparity, &min_val, &max_val);
|
|
|
|
|
-// SPDLOG_INFO("Min: {}, Max: {}", min_val, max_val);
|
|
|
|
|
-//
|
|
|
|
|
-// auto tmp = cv::Mat();
|
|
|
|
|
-// disparity.convertTo(tmp, CV_32FC1);
|
|
|
|
|
-// tmp = (tmp - min_val) / (max_val - min_val) * 255.f;
|
|
|
|
|
-// tmp.convertTo(disparity, CV_8UC1);
|
|
|
|
|
-// cv::imwrite("disparity.png", disparity);
|
|
|
|
|
-//
|
|
|
|
|
-// glfwSetWindowShouldClose(glfwGetCurrentContext(), true);
|
|
|
|
|
-//}
|
|
|
|
|
-
|
|
|
|
|
-#include "image_process/camera_calibrator.h"
|
|
|
|
|
-#include "module/experiment/calib_eval.h"
|
|
|
|
|
|
|
+#include <GLFW/glfw3.h>
|
|
|
|
|
|
|
|
app_debug::app_debug(const create_config &conf) {
|
|
app_debug::app_debug(const create_config &conf) {
|
|
|
- auto cam_info = camera_calibrator::result_type();
|
|
|
|
|
- auto calib_conf = camera_calibrator::create_config{
|
|
|
|
|
- .pattern_size = cv::Size(11, 8),
|
|
|
|
|
- .corner_distance = 5,
|
|
|
|
|
- .cb_func = [&](auto info) { cam_info = info; },
|
|
|
|
|
- };
|
|
|
|
|
- auto calib = std::make_unique<camera_calibrator>(calib_conf);
|
|
|
|
|
-
|
|
|
|
|
- auto sim_info = camera_calibrator::simulate_info_type{
|
|
|
|
|
- .data_path = "/home/tpx/project/DepthGuide/cmake-build-debug/exp-20240605/calib/calib_data_c1.txt",
|
|
|
|
|
- .img_size = cv::Size(1920, 1080),
|
|
|
|
|
- };
|
|
|
|
|
- calib->simulate_process(sim_info);
|
|
|
|
|
-
|
|
|
|
|
- std::string eval_path_list[] = {
|
|
|
|
|
- "/home/tpx/project/DepthGuide/cmake-build-debug/exp-20240605_bak/videos/Stable_Pose_1_1717595907048131",
|
|
|
|
|
- "/home/tpx/project/DepthGuide/cmake-build-debug/exp-20240605_bak/videos/Stable_Pose_2_1717596106615177",
|
|
|
|
|
- "/home/tpx/project/DepthGuide/cmake-build-debug/exp-20240605_bak/videos/Stable_Pose_3_1717596157508744",
|
|
|
|
|
- "/home/tpx/project/DepthGuide/cmake-build-debug/exp-20240605_bak/videos/Stable_Pose_4_1717596214643474",
|
|
|
|
|
- "/home/tpx/project/DepthGuide/cmake-build-debug/exp-20240605_bak/videos/Stable_Pose_5_1717596236889051",
|
|
|
|
|
- "/home/tpx/project/DepthGuide/cmake-build-debug/exp-20240605_bak/videos/Stable_Pose_6_1717596274604857",
|
|
|
|
|
- "/home/tpx/project/DepthGuide/cmake-build-debug/exp-20240605_bak/videos/Stable_Pose_7_1717596308077328",
|
|
|
|
|
- "/home/tpx/project/DepthGuide/cmake-build-debug/exp-20240605_bak/videos/Stable_Pose_8_1717596347701421",
|
|
|
|
|
- "/home/tpx/project/DepthGuide/cmake-build-debug/exp-20240605_bak/videos/Dynamic_Pose_1_1717596522706273"
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- auto eval = std::make_unique<calib_eval>(calib_eval::record_config{});
|
|
|
|
|
|
|
+ auto input = fitting_circle_3d::input_type();
|
|
|
|
|
+ auto points = std::vector<glm::vec3>();
|
|
|
|
|
+ points.emplace_back(100, 1, 2);
|
|
|
|
|
+ points.emplace_back(100, 2, 0);
|
|
|
|
|
+ points.emplace_back(100, 1, -1);
|
|
|
|
|
+ points.emplace_back(100, 0, 0);
|
|
|
|
|
+ input.points = to_eigen(points);
|
|
|
|
|
|
|
|
- auto eval_info = calib_eval::simulate_info_type::from_yaml(
|
|
|
|
|
- conf.ext_conf["eval_points"]);
|
|
|
|
|
- eval_info.cam = cam_info;
|
|
|
|
|
|
|
+ auto result = fitting_circle_3d()(input);
|
|
|
|
|
+ SPDLOG_DEBUG("{}, {}, {}", result.center[0], result.center[1], result.radius);
|
|
|
|
|
|
|
|
- for (auto &path: eval_path_list) {
|
|
|
|
|
- eval_info.save_folder = path;
|
|
|
|
|
- eval->simulate_eval(eval_info);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
glfwSetWindowShouldClose(glfwGetCurrentContext(), true);
|
|
glfwSetWindowShouldClose(glfwGetCurrentContext(), true);
|
|
|
-}
|
|
|
|
|
|
|
+}
|