Revision history [back]

Is there a way to prevent rounding in opencv matrix divison

I have an integer matrix and I want to perform an integer division on it. But opencv always rounds the result. I know I can divide each element manually but I want to know is there a better way for this or not?

Mat c = (Mat_ <int> (1,3) << 80,71,64 );
cout << c/8 << endl;

// result
//[10, 9, 8]

// desired result
//[10, 8, 8]

 2 retagged LBerger 9317 ●2 ●20 ●88 http://www.traimaocv.fr

Is there a way to prevent rounding in opencv matrix divison

I have an integer matrix and I want to perform an integer division on it. But opencv always rounds the result. I know I can divide each element manually but I want to know is there a better way for this or not?

Mat c = (Mat_ <int> (1,3) << 80,71,64 );
cout << c/8 << endl;

// result
//[10, 9, 8]

// desired result
//[10, 8, 8]