| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #include "app_debug.h"
- #include "GLFW/glfw3.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"
- app_debug::app_debug(const create_config &conf) {
- auto calib_conf = camera_calibrator::create_config{
- .pattern_size = cv::Size(11, 8),
- .corner_distance = 5,
- };
- 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_c5.txt",
- .img_size = cv::Size(1920, 1080),
- };
- calib->simulate_process(sim_info);
- }
|