Ask Your Question

Revision history [back]

saturate_cast is needed:

dst.at<uchar>(i,j) = saturate_cast<uchar>(scalarColor.val[0]*coeffs0[2] + scalarColor.val[1]*coeffs0[1] + scalarColor.val[2]*coeffs0[0]);

saturate_cast is needed:

dst.at<uchar>(i,j) = saturate_cast<uchar>(scalarColor.val[0]*coeffs0[2] + scalarColor.val[1]*coeffs0[1] + scalarColor.val[2]*coeffs0[0]);

see saturation-arithmetics