I have an image of type CV_32FC1 and I need to convert it binary without passing by the conversion to CV_8U since it seems to me that I'm loosing data by passing to it before going to binary.
result = Mat(res.size(),CV_32FC1);
for (int i = 0; i < res.rows ; i ++)
for (int j = 0; j < res.cols; j++)
{
result.at<float>(i,j) = (fabs(res.at<float>(i,j)) / 8);
}
result.convertTo(result, CV_8U);
threshold(result, imageBinary, 30, 255, CV_THRESH_BINARY);
Any idea how can I achieve it?