Ask Your Question
4

image type vs image depth

asked 2012-12-02 00:25:25 -0600

eyal gravatar image

Hi all,

I'm kind of new to OpenCv and I'm a little confused. Say I load and image via imread("someImage") into a Mat object named image. What is the difference between image.depth() and image.type() ??

I see it a lot in the documentations and tutorials and just don't get the difference.

I use OpenCV 2.4.2

Thank u in advance

Eyal

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
8

answered 2012-12-02 05:07:19 -0600

Michael Burdinov gravatar image

'Depth' is type of data of your image. Most used type is unsigned char but other data types may be used (signed char, unsigned short, signed short, int, float, double).

'Type' is combination of two separate values into one: 'depth' of image and number of channels in image. So when you provide 'type' of image to some function you actaully provide both 'depth' and number of channels.

You will find more information in this question.

edit flag offensive delete link more

Comments

Thank you!

eyal gravatar imageeyal ( 2012-12-03 00:48:36 -0600 )edit
1

answered 2012-12-02 02:48:04 -0600

updated 2012-12-02 05:16:02 -0600

The depth indicate to type of each pixel of image. for example for derivatives of image you need 16bit instead of 8bit. The channel indicate to count of channel of image (3 = RGB, 1 = Gray)

edit flag offensive delete link more

Comments

Thank you!

eyal gravatar imageeyal ( 2012-12-03 00:49:08 -0600 )edit

Question Tools

Stats

Asked: 2012-12-02 00:25:25 -0600

Seen: 27,533 times

Last updated: Dec 02 '12