Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Afaik with cv::add or +-operator you'll always have a saturate cast, so if you want to use these functions you'd need to convert A and B to CV_32S first:

A.convertTo(C, CV_32S);
B.convertTo(B, CV_32S);
C += B;

However: What speaks really against cv::addWeighted? I don't get your reason. I doubt, that

cv::addWeighted(A, 1, B, 1, 0, C, C.type());

is less efficient than simple add.

At last, what you can always do: loop over the matrix-dimension by hand and add the matrix-values.