I've written a C++ code using OpenCV functions, as below:
string mattype = findmattype(wxyz.type());
cout << "Type of wxyz: " << mattype.c_str() << endl;
Mat LastRowWeight = wxyz.row(rows - 1);
cout << "LastRowWeight =\n" << LastRowWeight << endl;
string mattype1 = findmattype(LastRowWeight.type());
cout << "Type of LastRowWeight: " << mattype1.c_str() << endl;
float LastRowSum = sum(LastRowWeight)[0];
The output is displayed as below:
For the last line of the code, I am getting a warning while building the solution: warning C4244: 'initializing' : conversion from 'double' to 'float', possible loss of data. I have seen other posts where users have reported this error but in those cases, the reason for the error looks clear to me.
For my case, the type of LastRowWeight is 32FC1 or float, then where is the conversion from double? Does the function 'sum' output a double value (when used with [0]) even if the input Mat object is of type float? Please guide since I'm new to OpenCV and C++.
P.S. findmattype is taken from How to find out what type of a Mat object is with Mat::type() in OpenCV