Main Page | Alphabetical List | Class List | File List | Class Members | File Members

SimplePixelImage.h File Reference

Computer images header. More...

Go to the source code of this file.

Classes

struct  _PixelSize
 Memory used by each pixels component. More...

struct  _SimplePixelImage
 A simple data type to store computer images. More...


Planes description for every ImageType

For each image type it is infered a planes structure
See also:
_SimplePixelImage


typedef enum _BWImagePlane BWImagePlane
 Planes for a Black White Image.

typedef enum _RGBImagePlane RGBImagePlane
enum  _BWImagePlane { BW_GREY, BW_PLANES_NUMBER }
 Planes for a Black White Image.

enum  _RGBImagePlane { RGB_RED, RGB_GREEN, RGB_BLUE, RGB_PLANES_NUMBER }

Typedefs

typedef enum _ImageType ImageType
 Image colour spaces.

typedef PixelType ** PixelPlane
 Pixel Plane data type.

typedef _PixelSize PixelSize
 Memory used by each pixels component.

typedef unsigned char PixelType
 Pixel data type.

typedef _SimplePixelImage SimplePixelImage
 A simple data type to store computer images.


Enumerations

enum  _ImageType {
  IMAGE_BW, IMAGE_RGB, IMAGE_HSV, IMAGE_HSL,
  IMAGE_TYPES_NUMBER
}
 Image colour spaces. More...


Functions

PixelPlane allocPixelPlane (unsigned uNumrows, unsigned uNumcols)
 Allocates a $ \mathtt{uNumrows} \times \mathtt{uNumcols} $ pixelPlane returning its pointer.

PixelPlaneallocPixelPlaneArray (SimplePixelImage const &inputImage)
 Returns a pointer to an allocated PixelPlaneArray with the dimensions given by the inputImage records.

void allocPixelPlanesArrayInSimplePixelImage (SimplePixelImage &inputImage)
 Allocates the PixelPlanesArray in inputImage with the dimensions given by inputImage records.

void copyPixelPlaneInSimplePixelImage (SimplePixelImage &inputImage, PixelPlane pixelPlane, unsigned uImagePlane)
void copyPixelPlanesArrayInSimplePixelImage (SimplePixelImage &destinationImage, PixelPlane *sourcePlanesArray)
void copySimplePixelImageParameters (SimplePixelImage &destinationImage, SimplePixelImage const &sourceImage)
void drawFrameInSimplePixelImage (SimplePixelImage &image, unsigned long frameLevel)
void freePixelPlane (PixelPlane pixelPlaneToFree)
void freePixelPlanesArray (PixelPlane *PlanesArray)
void freePixelPlanesArrayInSimplePixelImage (SimplePixelImage &inputImage)
void readPortableMapToSimplePixelImage (char const *source_file, SimplePixelImage &inputImage)
 Stores a Portable Map Image into a SimplePixelImage image data type.

void writeSimplePixelImageToPortableMap (SimplePixelImage const &outputImage, char const *file_name)


Detailed Description

Computer images header.

This header contains definition of wieldy types and functions which are helpful to deal with computer images.


Typedef Documentation

typedef enum _ImageType ImageType
 

Image colour spaces.

This enumeration is used to assign an image its colour representation type. Since the pixel colour data can be represented in many different ways.

  • A black and white image owes only an intensity representation (here IMAGE_BW)
  • A colour image has many representations: RGB, HUE, HSV...

typedef struct _PixelSize PixelSize
 

Memory used by each pixels component.

The SimplePixelImage type is based on a pixel component planes description of the image. This structure describes the memory used by each pixel component.

For instance:
In the RGB image each pixel uses a total of 24 bytes memory. But this memory is split in three 8-bytes parts, one for each colour (red, green, blue).
Therefore a rgb pixel is formed by 3 pixel components each of 8 bytes. And the values would be:
  • maxLevel = 255 ($ bits - 1 $) (since the 0 is included as the ground level)
  • bits = 256
  • bytes = 8 ($ bits/8 $)

typedef struct _SimplePixelImage SimplePixelImage
 

A simple data type to store computer images.

This structure data type can hold any pixel image.
It is only needed to initialize in a appropriate manner this structure and save the pixels information in ucPlanesArray array of planes.
Nevertheless there is a completely straightforward way to store Portable Map files image ( .ppm , .pgm ,...) into SimplePixelImage data type: through readPortableMapToSimplePixelImage.

How is stored the information of a pixel:
Every pixel is characterized by a pair of integers $ (row, col) $, which are its position expressed in rows and columns. In addition each pixels contains a certain colour information which is usually expressed as a vector with different components: RGB $ (r, g, b) $, CMYK $ (c, m, y, k) $, ...
Gathering together the same component of every pixel, a plane (matrix) is defined where each point coordinates are the pixels coordinates $ (row, col) $ and the value of each point is the component value. Thus the image is descomposed in as many planes as pixel components, each plane of the same dimension as the image dimension.
For Instance:
In an RGB image every pixel has 3 components $ (r, g, b) $. If we take apart The $ r $ component of each RGB pixel. We have a plane where every $ (row, col) $ position holds the $ r $ value of the corresponding red component of the pixel. Repeating the process for the GREEN and BLUE components we have de RGB image decomposed in 3 planes.


Enumeration Type Documentation

enum _ImageType
 

Image colour spaces.

This enumeration is used to assign an image its colour representation type. Since the pixel colour data can be represented in many different ways.

  • A black and white image owes only an intensity representation (here IMAGE_BW)
  • A colour image has many representations: RGB, HUE, HSV...
Enumeration values:
IMAGE_BW  Black and White.
IMAGE_RGB  Red Green Blue.
IMAGE_HSV  Hue Saturation Value.
IMAGE_HSL  Hue Saturation Lightness.


Function Documentation

PixelPlane* allocPixelPlaneArray SimplePixelImage const &  inputImage  ) 
 

Returns a pointer to an allocated PixelPlaneArray with the dimensions given by the inputImage records.

These are: uNumrows , uNumCols , uPlanesNumber ,

void allocPixelPlanesArrayInSimplePixelImage SimplePixelImage inputImage  ) 
 

Allocates the PixelPlanesArray in inputImage with the dimensions given by inputImage records.

When a SimplePixelImage is declared no memory is allocated for its PixelPlane array . That is due to the fact that in order to allocate a PixelPlane array, it must be known:

  1. The size of the image
  2. The number of planes of the image

Therefore, before using allocPixelPlaneArray it is needed to have initialized:

  1. uNumrows .
  2. uNumCols .
  3. uPlanesNumber .

void readPortableMapToSimplePixelImage char const *  source_file,
SimplePixelImage inputImage
 

Stores a Portable Map Image into a SimplePixelImage image data type.

Parameters:
[in] source_file a pointer to the file name string.
[in,out] inputImage SimplePixelImage variable where to store the image.


Generated on Wed Jul 14 17:25:04 2004 for Segmentation by doxygen 1.3.7