Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Save custom object in .yml

Hi, does anyone know how to save a custom object in .yml using FileStorage ?

According to the online document: http://docs.opencv.org/3.0-rc1/dd/d74/tutorial_file_input_output_with_xml_yml.html

I add the following snippet in my custom class ColorSample:

void ColorSample::read(const FileNode& node) { mat = (Mat)node["mat"]; // Error: no matching function for call to cv::Mat::Mat(cv::FileNode) loc = (Point)node["loc"]; // Error: no matching function for call to cv::Point_<int>::Point_(cv::FileNode) color = (Scalar)node["color"]; }

Does anyone know how to solve the first two lines in ColorSample::read() ? Thanks

Save custom object in .yml

Hi, does anyone know how to save a custom object in .yml using FileStorage ?

According to the online document: http://docs.opencv.org/3.0-rc1/dd/d74/tutorial_file_input_output_with_xml_yml.html

I add the following snippet in my custom class ColorSample:

void ColorSample::read(const FileNode& FileNode& node) { {
mat = (Mat)node["mat"]; // Error: no matching function for call to cv::Mat::Mat(cv::FileNode) to cv::Mat::Mat(cv::FileNode)
loc = (Point)node["loc"]; // Error: no matching function for call to cv::Point_<int>::Point_(cv::FileNode) call to cv::Point_<int>::Point_(cv::FileNode)
color = (Scalar)node["color"];
}

Does anyone know how to solve the first two lines in ColorSample::read() ? Thanks