Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

void phRGBX_XBGR_to_SCTX uint32_t  nelems,
uint8_t  id,
uint8_t  od,
uint8_t  order,
uint8_t  offset,
uint8_t src,
uint8_t **  dst,
uint32_t pdstsize
 

This performs a conversion from an RGB space to SCT space. The algorithm for RGB to SCT color space was found in:
Computer Vision and Image Processing
a practical approach using CVIPtools
by Scott E Umbaugh

SCT or Spherical Coordinate Tranform has 3 bytes: L, A and B (Don't confuse B with b; B is the angle B and b is the blue of RGB) L = sqrt(R^2 + G^2 + B^2)
A = cos^(-1)(B/L)
B = cos^(-1)(R / (L sin (A)))

Scaling is done on L, A and B to fit it into an 8 bit byte location. MAX(L) = sqrt(255*255 + 255*255 + 255*255) = 441.6729559
MIN(L) = 0.0
MAX(A) = MAX(B) = 1.0
MIN(A) = MIN(B) = 0.0

Attention:
This function is not very useful because the values for SCT are clipped into a 0-255 value range. SCT needs more than 1 byte of space in order to correctly convert from RGB to SCT and from SCT to RGB without loosing information. Until Phission supports different channel data types (float,short,int,etc), this functionality will not be useful.
Parameters:
[in] nelems The number of pixel elements in the image. This is usually the image width times the image height.
[in] id The input depth(bytes)/number of channels of the RGB format
[in] od The output depth(bytes)/number of channels of the SCT format
[in] order The order of the RGB chanels: 0=RGBX, 1=XBGR. This combined with the offset allows for a few variations of the pixel channels. For example: order=1, offset=1, od=4 is the ABGR format.
[in] offset A byte value offset into each pixel at which the RGB channels start. For example, ABGR has an offset of one.
[in] src The source of the RGB image data
[out] dst The destination of the converted data
[out] pdstsize The size of the allocated (possibly resized) dst buffer.

Definition at line 1500 of file ImageConversions.c.





Copyright (C) 2002 - 2007 Philip D.S. Thoren ( pthoren@users.sourceforge.net )
University Of Massachusetts at Lowell
Robotics Lab
SourceForge.net Logo

Generated on Sat Jun 16 02:45:26 2007 for phission by  doxygen 1.4.4