Ask Your Question
1

floor of a matrix in OpenCV 2.4.3

asked 2013-02-18 23:00:41 -0600

UserOpenCV gravatar image

Hi,

I have a matrix of type Mat. I want to calculate floor of the Mat. I have searched the Operations on Arrays and The core functionality documentation.

Below is a sample code

Mat M = (Mat_<double>(3,3) << 1.2, 0.3, 0.9, 2.3, 1.1, 0.7, 10.2, 10,3, 8.0, 11.6);

I am looking for something like

floor(M, M) or 
M = floor(M)

Can anyone tell me how to do this? Platform C++

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-02-20 03:39:36 -0600

shray gravatar image

You could just loop over every element in the matrix and do a floor on it. For loops are optimized in opencv so there should be no compromise on speed, but if you were looking for something that could be written in one line then I guess this is not the answer for you. I haven't seen any such functions in opencv, though I am currently new to it.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-02-18 23:00:41 -0600

Seen: 3,297 times

Last updated: Feb 20 '13