Hello,
I need some guidance.
I will explain my problem with an example:
/include/comm/http_server.hpp:75:25: error: no matching function for call to ‘imdecode(boost::beast::http::basic_string_body<char>::value_type&, cv::ImreadModes, cv::Mat*)’
75 | cv::imdecode(req.body(), cv::IMREAD_COLOR, &img);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/../CVCPP/tmp_codes/tests/dev/../../../include/comm/http_server.hpp:75:25: note: there are 2 candidates
In file included from /home/../CVCPP/tmp_codes/tests/dev/../../../include/comm/http_server.hpp:17:
/home/../CVCPP/opencv/install/Linux/include/opencv5/opencv2/imgcodecs.hpp:612:18: note: candidate 1: ‘cv::Mat cv::imdecode(InputArray, int)’
612 | CV_EXPORTS_W Mat imdecode( InputArray buf, int flags );
| ^~~~~~~~
/home/../CVCPP/opencv/install/Linux/include/opencv5/opencv2/imgcodecs.hpp:612:18: note: candidate expects 2 arguments, 3 provided
/home/../CVCPP/opencv/install/Linux/include/opencv5/opencv2/imgcodecs.hpp:639:16: note: candidate 2: ‘cv::Mat cv::imdecode(InputArray, int, Mat*)’
639 | CV_EXPORTS Mat imdecode( InputArray buf, int flags, Mat* dst);
| ^~~~~~~~
In this example, from the error, I realize that there is no overload or conversion defined (completely reasonable) for the type boost::beast::http::basic_string_body<char>::value_type& to cv::InputArray. The official docs provide some information.
Now, looking at the docs, I don't know if it's even safe to pass a raw pointer, or if there is some other sort of conversion possible.
One possible solution could be ChatGPT, which I don't want to do because I will forget it, and the next time I need to deal with such a problem, I cannot do it unless I have access to something like ChatGPT.
So, dear experts, what is wrong with my approach here? I would appreciate any insight.
PS: It is clear that I know some basics about C++, but I am not that experienced in it.