Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Round/Absolute Value each element of Mat

I am new to opencv and am trying to convert this line of matlab code to java using opencv 3.1:

  • user_feature_matrix_normalize = abs(round(user_feature_matrix.*100)); //matlab code

I think I figured out multiplication and this is what I have so far:

  • Mat user_feature_matrix_normalize = new Mat(); //java opencv code
  • Scalar alpha =new Scalar(100);
  • Core.multiply(user_feature_matrix, alpha, user_feature_matrix_normalize);

Are there any opencv functions I can use to round and take the absolute value of each element of the mat? Looking for any suggestions on how I should try to accomplish this