frameconversions.h File Reference

This file contains definitions and structures needed to use frame conversions. More...

#include "frametypes.h"
#include <libfg/frame.h>

Include dependency graph for frameconversions.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define SCALINGCONST   65535
 This is the scaling constant from theoretical HSV values in [0,1] to unsigned short values for integer arithmetics.
#define SCALINGCONST_3   21845
 A third of the scaling constant.
#define SCALINGCONST_6   10922
 A sixth of the scaling constant.
#define SCALINGCONSTSIZE   16
 Size of the scaling constant, in bits.
#define SHIFT2CHAR   8
 How many bitshifts to create a char from our type (in case of short: 8, in case of char: 0).

Functions

void dhsv2bgr (const dhsv_pixel_t *hsv, bgr_pixel_t *bgr)
 This function converts a HSV pixel (encoded in double values to a BGR pixel.
void fhsv2bgr (const fhsv_pixel_t *hsv, bgr_pixel_t *bgr)
 This function converts a HSV pixel (encoded in float values to a BGR pixel.
void shsv2bgr (const shsv_pixel_t *hsv, bgr_pixel_t *bgr)
 This function converts a HSV pixel (encoded in short int values to a BGR pixel.
void bgr2dhsv (const bgr_pixel_t *bgr, dhsv_pixel_t *hsv)
 This function converts a BGR pixel to a HSV pixel encoded in double values.
void bgr2fhsv (const bgr_pixel_t *bgr, fhsv_pixel_t *hsv)
 This function converts a BGR pixel to a HSV pixel encoded in float values.
void bgr2shsv (const bgr_pixel_t *bgr, shsv_pixel_t *hsv)
 This function converts a BGR pixel to a HSV pixel encoded in short int values.
bgr_frame_tcreate_bgr_frame (int width, int height)
 Creates a new BGR frame and allocates memory for it.
void drop_bgr_frame (bgr_frame_t *frame)
 Clears the frame and frees all allocated memory.
shsv_frame_tcreate_shsv_frame (int width, int height)
 Creates a new HSV frame and allocates memory for it.
void drop_shsv_frame (shsv_frame_t *frame)
 Clears the frame and frees all allocated memory.
int convert_fbframe2bgr (const FRAME *fbframe, bgr_frame_t *bgrf)
 Converts the frame we get from libfg to a BGR frame.
int convert_shsv2bgr (const shsv_frame_t *shsvf, bgr_frame_t *bgrf)
 Converts a HSV frame to BGR frame.
int convert_bgr2shsv (const bgr_frame_t *bgrf, shsv_frame_t *shsvf)
 Converts a BGR frame to HSV frame.
int send_bgr_frame (int fd, const bgr_frame_t *frame)
 Send a BGR frame to the given file descriptor.


Detailed Description

This file contains definitions and structures needed to use frame conversions.

We need frame conversions between RGB and HSV color spaces because searching for blobs im very much easier in HSV color space.

Version:
Id
frameconversions.h,v 1.11 2008/09/18 12:59:01 prokop Exp

Definition in file frameconversions.h.


Define Documentation

#define SCALINGCONST   65535

This is the scaling constant from theoretical HSV values in [0,1] to unsigned short values for integer arithmetics.

Definition at line 37 of file frameconversions.h.

#define SCALINGCONST_3   21845

A third of the scaling constant.

Definition at line 39 of file frameconversions.h.

#define SCALINGCONST_6   10922

A sixth of the scaling constant.

Definition at line 41 of file frameconversions.h.

#define SCALINGCONSTSIZE   16

Size of the scaling constant, in bits.

Definition at line 43 of file frameconversions.h.

#define SHIFT2CHAR   8

How many bitshifts to create a char from our type (in case of short: 8, in case of char: 0).

Definition at line 45 of file frameconversions.h.


Function Documentation

void bgr2dhsv ( const bgr_pixel_t bgr,
dhsv_pixel_t hsv 
)

This function converts a BGR pixel to a HSV pixel encoded in double values.

Parameters:
bgr pointer to BGR pixel structure
hsv pointer to HSV pixel structure, which will be overwritten
See also:
http://de.wikipedia.org/wiki/HSV-Farbraum

Definition at line 211 of file frameconversions.c.

void bgr2fhsv ( const bgr_pixel_t bgr,
fhsv_pixel_t hsv 
)

This function converts a BGR pixel to a HSV pixel encoded in float values.

Parameters:
bgr pointer to BGR pixel structure
hsv pointer to HSV pixel structure, which will be overwritten
See also:
http://de.wikipedia.org/wiki/HSV-Farbraum

Definition at line 241 of file frameconversions.c.

void bgr2shsv ( const bgr_pixel_t bgr,
shsv_pixel_t hsv 
) [inline]

This function converts a BGR pixel to a HSV pixel encoded in short int values.

Parameters:
bgr pointer to BGR pixel structure
hsv pointer to HSV pixel structure, which will be overwritten
See also:
http://de.wikipedia.org/wiki/HSV-Farbraum

Definition at line 272 of file frameconversions.c.

int convert_bgr2shsv ( const bgr_frame_t bgrf,
shsv_frame_t shsvf 
)

Converts a BGR frame to HSV frame.

Parameters:
bgrf Frame in BGR format
shsvf Target frame in HSV format, which has to be the same size as bgrf
Returns:
1 on successful conversion, 0 on error

Definition at line 445 of file frameconversions.c.

int convert_fbframe2bgr ( const FRAME *  fbframe,
bgr_frame_t bgrf 
)

Converts the frame we get from libfg to a BGR frame.

Parameters:
fbframe Frame from libfg
bgrf BGR frame which has to be the same size as fbframe
Returns:
1 on success, 0 on error

Definition at line 367 of file frameconversions.c.

int convert_shsv2bgr ( const shsv_frame_t shsvf,
bgr_frame_t bgrf 
)

Converts a HSV frame to BGR frame.

Parameters:
shsvf Frame in HSV format
bgrf Target frame in BGR format, which has to be the same size as shsvf
Returns:
1 on successful conversion, 0 on error

Definition at line 433 of file frameconversions.c.

bgr_frame_t* create_bgr_frame ( int  width,
int  height 
)

Creates a new BGR frame and allocates memory for it.

Parameters:
width Width of the frame
height Height of the frame
Returns:
pointer to the new frame

Definition at line 313 of file frameconversions.c.

shsv_frame_t* create_shsv_frame ( int  width,
int  height 
)

Creates a new HSV frame and allocates memory for it.

Parameters:
width Width of the frame
height Height of the frame
Returns:
pointer to the new frame

Definition at line 340 of file frameconversions.c.

void dhsv2bgr ( const dhsv_pixel_t hsv,
bgr_pixel_t bgr 
)

This function converts a HSV pixel (encoded in double values to a BGR pixel.

Parameters:
hsv pointer to HSV pixel structure
bgr pointer to BGR pixel structure, which will be overwritten
See also:
http://de.wikipedia.org/wiki/HSV-Farbraum

Definition at line 37 of file frameconversions.c.

void drop_bgr_frame ( bgr_frame_t frame  ) 

Clears the frame and frees all allocated memory.

Parameters:
frame BGR frame to drop

Definition at line 329 of file frameconversions.c.

void drop_shsv_frame ( shsv_frame_t frame  ) 

Clears the frame and frees all allocated memory.

Parameters:
frame HSV frame to drop

Definition at line 356 of file frameconversions.c.

void fhsv2bgr ( const fhsv_pixel_t hsv,
bgr_pixel_t bgr 
)

This function converts a HSV pixel (encoded in float values to a BGR pixel.

Parameters:
hsv pointer to HSV pixel structure
bgr pointer to BGR pixel structure, which will be overwritten
See also:
http://de.wikipedia.org/wiki/HSV-Farbraum

Definition at line 92 of file frameconversions.c.

int send_bgr_frame ( int  fd,
const bgr_frame_t frame 
)

Send a BGR frame to the given file descriptor.

We need it to send the frame over the network.

Parameters:
fd A file descriptor open for writing
frame the BGR frame we want to send
Returns:
Number of sent bytes

Definition at line 457 of file frameconversions.c.

void shsv2bgr ( const shsv_pixel_t hsv,
bgr_pixel_t bgr 
) [inline]

This function converts a HSV pixel (encoded in short int values to a BGR pixel.

Parameters:
hsv pointer to HSV pixel structure
bgr pointer to BGR pixel structure, which will be overwritten
See also:
http://de.wikipedia.org/wiki/HSV-Farbraum

Definition at line 147 of file frameconversions.c.


Generated on Sun Sep 28 21:20:01 2008 for Guard by  doxygen 1.5.6