Ask Your Question
0

cvMat data size

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

drKzs gravatar image

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

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

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

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

Moster gravatar image

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

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)

edit flag offensive delete link more

Comments

ok, thanx :)

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

helpful, thank you.

Overmind735 gravatar imageOvermind735 ( 2018-08-17 15:32:38 -0600 )edit

Question Tools

Stats

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

Seen: 13,416 times

Last updated: Sep 24 '13