$darkmode
404 Not Found

404 Not Found


nginx
OpenCV 4.11.0
Open Source Computer Vision
BEGIN_CUSTOM_MATHJAX // END_CUSTOM_MATHJAX
Exporting a template parameter file

Goal

In this tutorial you will learn how to

  • create a simple parameter file template.
#include <opencv2/core.hpp>
using namespace cv;
using namespace std;
int main(int argc, char* argv[])
{
Ptr<stereo::QuasiDenseStereo> stereo = stereo::QuasiDenseStereo::create(cv::Size(5,5));
std::string parameterFileLocation = "./parameters.yaml";
if (argc > 1)
parameterFileLocation = argv[1];
stereo->saveParameters(parameterFileLocation);
return 0;
}
Template class for specifying the size of an image or rectangle.
Definition: modules/core/include/opencv2/core/types.hpp:335
int main(int argc, char *argv[])
Definition: highgui_qt.cpp:3
GMat stereo(const GMat &left, const GMat &right, const StereoOutputFormat of=StereoOutputFormat::DEPTH_FLOAT32)
Computes disparity/depth map for the specified stereo-pair. The function computes disparity or depth ...
Definition: core/include/opencv2/core.hpp:107
STL namespace.

Explanation:

The class supports loading configuration parameters from a .yaml file using the method loadParameters(). This is very useful for fine-tuning the class' parameters on the fly. To extract a template of this parameter file you run the following code.

We create an instance of a QuasiDenseStereo object. Not specifying the second argument of the constructor, makes the object to load default parameters.

Ptr<stereo::QuasiDenseStereo> stereo = stereo::QuasiDenseStereo::create(cv::Size(5,5));

By calling the method saveParameters(), we store the template file to the location specified by parameterFileLocation

std::string parameterFileLocation = "./parameters.yaml";
if (argc > 1)
parameterFileLocation = argv[1];
stereo->saveParameters(parameterFileLocation);