IplImage in OpenCV

You might run into the IplImage structure while looking at OpenCV code. It is an old structure that is present from the days when OpenCV was called Intel Processing Library, hence IPL.

The different members of IplImage and their descriptions can be found here. The declaration of IplImage can be found in modules/core/include/opencv2/core/types_c.h of the OpenCV source code, as can be seen here.

The basic structure of IplImage is:

#define IPL_DEPTH_1U     1
#define IPL_DEPTH_8U     8
#define IPL_DEPTH_16U   16
#define IPL_DEPTH_32F   32
#define IPL_DEPTH_SIGN 0x80000000

struct IplImage
    int depth; // Datatype of pixel (see above)
    int nChannels; // 1, 2, 3 or 4
    int width;
    int height;
    char* imageData;
    int widthStep;

Constructing it is easy:

IplImage* img = cvCreateImage(cvSize(200, 200), IPL_DEPTH_32F, 1); // 1-channel float image

The modern Mat structure in OpenCV is preferable to using IplImage. IplImage can be converted to Mat as described here.

One thought on “IplImage in OpenCV

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.