Attention! This forum will be made read-only by Dec-20. Please migrate to Most of existing active users should've received invitation by e-mail.
Ask Your Question

cvMat data size

asked 2013-09-24 11:15:27 -0500

drKzs gravatar image

updated 2013-09-24 11:28:30 -0500

berak gravatar image


Sorry if the question has been asked already, but i'm not sure of the simple answer : how to determine the cv::Mat data field size ?

I've read this page : link text

So rows*step is enough, no need to take care of elemSize or depth ?

Thanx a lot :)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-09-24 14:59:17 -0500

Moster gravatar image

updated 2013-09-24 15:00:39 -0500

The simplest way I know is:

int bytes = * Mat.elemSize();

The returns rows x cols and Mat.elemSize() returns channels x sizeof(type)

edit flag offensive delete link more


ok, thanx :)

drKzs gravatar imagedrKzs ( 2013-09-25 09:40:49 -0500 )edit

helpful, thank you.

Overmind735 gravatar imageOvermind735 ( 2018-08-17 15:32:38 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2013-09-24 11:15:27 -0500

Seen: 9,266 times

Last updated: Sep 24 '13