Sie sind auf Seite 1von 3

Image Understanding and Processing (OpenCV)

Lab Exercise 03
Year 4 Basic Spatial Domain Image Enhancement
In this practical we are going to test on more image enhancement techniques and this category is based on direct manipulation of pixels in an image. The principal objective of enhancement is to process an image so that the result is more suitable than the original image for a specific application. Spatial domain processes are denoted by: g(x,y) = T[ f(x,y) ] s = T[ r ] A neighbourhood about a point (x, y) is a square or rectangular sub-image area centred at (x, y)

Semester 1, 2012

Exercise: 1. Write a program to extract data of an image E.g.: height, width and no of channels

The following describe the Basic OpenCV data structure Image data structure IPL image: IplImage |-- int nChannels; // Number of color channels (1,2,3,4) |-- int depth; // Pixel depth in bits: | // IPL_DEPTH_8U, IPL_DEPTH_8S, | // IPL_DEPTH_16U,IPL_DEPTH_16S, | // IPL_DEPTH_32S,IPL_DEPTH_32F, | // IPL_DEPTH_64F |-- int width; // image width in pixels |-- int height; // image height in pixels |-- char* imageData; // pointer to aligned image data | // Note that color images are stored in BGR order |-- int dataOrder; // 0 - interleaved color channels, | // 1 - separate color channels | // cvCreateImage can only create interleaved images |-- int origin; // 0 - top-left origin, | // 1 - bottom-left origin (Windows bitmaps style) |-- int widthStep; // size of aligned image row in bytes |-- int imageSize; // image data size in bytes = height*widthStep |-- struct _IplROI *roi;// image ROI. when not NULL specifies image | // region to be processed. |-- char *imageDataOrigin; // pointer to the unaligned origin of image data | // (needed for correct image deallocation) | |-- int align; // Alignment of image rows: 4 or 8 byte alignment | // OpenCV ignores this and uses widthStep instead |-- char colorModel[4]; // Color model - ignored by OpenCV

2. Write separate programs to the following grey level processing with the help of the given methods of OpenCV. Log transformation Inverse Log transformation Power Law transformation Grey-level slicing

Split image onto the colour planes: cvSplit( src, r, g, b, NULL ); Merge colour planes into image: cvMerge(r, g, b, NULL, dst); Return the particular element of single-channel array: cvGetReal2D( const CvArr* arr, int idx0, int idx1 ); Change the particular array element: cvSetReal2D( CvArr* arr, int idx0, int idx1, double value );

Das könnte Ihnen auch gefallen