c++ - Is there a way to prevent rounding in opencv matrix divison -


i have integer matrix , want perform integer division on it. opencv rounds result. know can divide each element manually want know there better way or not?

mat c = (mat_ <int> (1,3) << 80,71,64 ); cout << c/8 << endl;  // result //[10, 9, 8]  // desired result //[10, 8, 8] 

similar @gppk's optional method, can hack by:

mat tmp, dst; c.convertto(tmp, cv_64f); tmp = tmp / 8 - 0.5;            // simulate prevent rounding -0.5 tmp.convertto(dst, cv_32s);  cout << dst; 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -