Ask Your Question
0

cvMat data size

asked Sep 24 '13

drKzs gravatar image

updated Sep 24 '13

berak gravatar image

Hello,

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 :)

Preview: (hide)

1 answer

Sort by » oldest newest most voted
3

answered Sep 24 '13

Moster gravatar image

updated Sep 24 '13

The simplest way I know is:

int bytes = Mat.total() * Mat.elemSize();

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

Preview: (hide)

Comments

ok, thanx :)

drKzs gravatar imagedrKzs (Sep 25 '13)edit

helpful, thank you.

Overmind735 gravatar imageOvermind735 (Aug 17 '18)edit

Question Tools

Stats

Asked: Sep 24 '13

Seen: 13,835 times

Last updated: Sep 24 '13