LLIPS  rev33
Light Library for Image ProcesS
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Macros | Typedefs | Enumerations | Functions
llips_general.h File Reference

About general image handling. More...

Go to the source code of this file.

Macros

#define OFFSET_SIGN   0x0000
 
#define OFFSET_IMG_P_DATA   0x000A
 
#define OFFSET_IMG_WIDTH   0x0012
 
#define OFFSET_IMG_HEIGHT   0x0016
 
#define OFFSET_IMG_DEPTH   0x001C
 
#define OFFSET_SIGN_size   2
 
#define OFFSET_IMG_P_DATA_size   4
 
#define OFFSET_IMG_WIDTH_size   4
 
#define OFFSET_IMG_HEIGHT_size   4
 
#define OFFSET_IMG_DEPTH_size   2
 
#define PIXEL_size   1
 
#define WIN_BMP   0x4D42
 
#define OFFSET_IMG_DATA_WIN24bit   0x0036
 
#define DEPTH_24bit   24
 
#define PIXEL_8bit_RANGE   255
 
#define BLUE   0x0001
 
#define GREEN   0x0010
 
#define RED   0x0100
 
#define HEADER   0x1000
 
#define ERR_NONE   0x0000
 
#define ERR_NOFILE   0x0001
 
#define ERR_NOT_WINBMP   0x0002
 
#define ERR_NOT_24bit   0x0003
 
#define ERR_TOO_WIDTH   0x0004
 
#define ERR_TOO_HEIGHT   0x0005
 
#define ERR_HEADER_TOO_BIG   0x0006
 
#define ERR_OPENFILE   0x0007
 
#define NO_DIFF   0x0000
 
#define DIFF_SIZE   0x0001
 
#define DIFF_BLUE   0x0002
 
#define DIFF_GREEN   0x0004
 
#define DIFF_RED   0x0008
 
#define DIFF_HIGH_QUANTITY   0x0010
 
#define FILTER_SIZE_USER   15
 
#define FILTER_SIZE   FILTER_SIZE_USER
 
#define PI   3.141592653589793
 
#define GetBlue(c)   0xFF&(c)
 
#define GetGreen(c)   0xFF&(c>>8)
 
#define GetRed(c)   0xFF&(c>>16)
 
#define SetRGB(r, g, b)   ((0xFF&r)<<16) | ((0xFF&g)<<8 ) | (0xFF&b)
 

Typedefs

typedef enum te_color e_color
 

Enumerations

enum  te_color { c_Red = 0, c_Green = 1, c_Blue = 2, c_color_size }
 

Functions

CPU_VOID display_img_value (t_img *img, CPU_INT16S colors)
 Display each color of image in ascii. More...
 
CPU_VOID init_area (t_area *area, CPU_INT16U maxwidth, CPU_INT16U maxheight)
 Initialize an area from 0,0 to given values. More...
 
CPU_VOID highlight_area (t_img *img, t_area *area, CPU_INT32U RGB)
 Draw a rectangular area on image in a given color. More...
 
CPU_VOID printf_area (t_area *area)
 Display area corner coordonate in a console. More...
 
t_vect highlight_line (t_img *img, t_pixel pix1, t_pixel pix2, CPU_INT32U RGB)
 Draw a line on image in a given color. More...
 
t_area pixel_to_area (t_pixel pix)
 Convert a pixel into a area of 1 x 1. More...
 
t_vect pixels_to_vector (t_pixel pix1, t_pixel pix2)
 Convert two pixel into a vector. More...
 
CPU_INT16U vectormodule (t_vect vect)
 Give module of a vector, in "pixel". More...
 
CPU_CHAR color_filter (t_img *img_in, t_img *img_out, CPU_INT32U color)
 Create an image with only the color provided. More...
 
CPU_CHAR histogram (t_img *img_in, t_img *img_out)
 Create an image with a view of histogram (RGBY). More...
 
CPU_CHAR luminance (t_img *img_in, t_img *img_out)
 Create an image only luminance data (desaturated image) More...
 
CPU_CHAR apply_linfilter (t_img *img_in, CPU_FP64 **tab_filtre, CPU_INT16S filtersize, CPU_INT32U color, t_img *img_out)
 Apply a predefined filter on the image. More...
 
CPU_FP64 conv_gauss (CPU_INT16S x, CPU_INT16S y, CPU_FP64 sig)
 Gaussian convolution, used to create gaussian filter. More...
 
CPU_VOID create_gauss_filter (CPU_FP64 **tab_filtre, CPU_INT16S filtersize, CPU_FP64 sigma)
 Create a Gaussian filter used to smooth and image. More...
 
CPU_VOID create_average_filter (CPU_FP64 **tab_filtre, CPU_INT16S filtersize)
 Create an average filter for smoothing. More...
 
CPU_INT16S create_laplacian_filter (CPU_FP64 **tab_filtre, CPU_INT08U filtertype)
 Create a laplacian filter for edge detection (return matrix must have a size of 3 or 5) More...
 
CPU_CHAR apply_median_filter (t_img *img_in, CPU_INT16S filtersize, t_img *img_out)
 Apply a median filter on an image. More...
 
CPU_INT08U get_median (CPU_INT08U **table2D, CPU_INT16S filter_range, CPU_INT16S i, CPU_INT16S j)
 Calcultate the median value of an area surrounding a pixel. More...
 
CPU_VOID display_filter_value (CPU_FP64 **tab_filtre, CPU_INT08U filtersize)
 Display values contained in a square filter. More...
 

Detailed Description

About general image handling.

Author
MPE

Definition in file llips_general.h.

Macro Definition Documentation

#define BLUE   0x0001

Definition at line 32 of file llips_general.h.

#define DEPTH_24bit   24

Definition at line 28 of file llips_general.h.

#define DIFF_BLUE   0x0002

Definition at line 58 of file llips_general.h.

#define DIFF_GREEN   0x0004

Definition at line 59 of file llips_general.h.

#define DIFF_HIGH_QUANTITY   0x0010

Definition at line 61 of file llips_general.h.

#define DIFF_RED   0x0008

Definition at line 60 of file llips_general.h.

#define DIFF_SIZE   0x0001

Definition at line 57 of file llips_general.h.

#define ERR_HEADER_TOO_BIG   0x0006

Definition at line 52 of file llips_general.h.

#define ERR_NOFILE   0x0001

Definition at line 47 of file llips_general.h.

#define ERR_NONE   0x0000

Definition at line 46 of file llips_general.h.

#define ERR_NOT_24bit   0x0003

Definition at line 49 of file llips_general.h.

#define ERR_NOT_WINBMP   0x0002

Definition at line 48 of file llips_general.h.

#define ERR_OPENFILE   0x0007

Definition at line 53 of file llips_general.h.

#define ERR_TOO_HEIGHT   0x0005

Definition at line 51 of file llips_general.h.

#define ERR_TOO_WIDTH   0x0004

Definition at line 50 of file llips_general.h.

#define FILTER_SIZE   FILTER_SIZE_USER

Definition at line 70 of file llips_general.h.

#define FILTER_SIZE_USER   15

Definition at line 64 of file llips_general.h.

#define GetBlue (   c)    0xFF&(c)

Macro

Definition at line 80 of file llips_general.h.

#define GetGreen (   c)    0xFF&(c>>8)

Definition at line 81 of file llips_general.h.

#define GetRed (   c)    0xFF&(c>>16)

Definition at line 82 of file llips_general.h.

#define GREEN   0x0010

Definition at line 33 of file llips_general.h.

#define HEADER   0x1000

Definition at line 35 of file llips_general.h.

#define NO_DIFF   0x0000

Definition at line 56 of file llips_general.h.

#define OFFSET_IMG_DATA_WIN24bit   0x0036

Definition at line 27 of file llips_general.h.

#define OFFSET_IMG_DEPTH   0x001C

Definition at line 17 of file llips_general.h.

#define OFFSET_IMG_DEPTH_size   2

Definition at line 23 of file llips_general.h.

#define OFFSET_IMG_HEIGHT   0x0016

Definition at line 16 of file llips_general.h.

#define OFFSET_IMG_HEIGHT_size   4

Definition at line 22 of file llips_general.h.

#define OFFSET_IMG_P_DATA   0x000A

Definition at line 14 of file llips_general.h.

#define OFFSET_IMG_P_DATA_size   4

Definition at line 20 of file llips_general.h.

#define OFFSET_IMG_WIDTH   0x0012

Definition at line 15 of file llips_general.h.

#define OFFSET_IMG_WIDTH_size   4

Definition at line 21 of file llips_general.h.

#define OFFSET_SIGN   0x0000

Definition at line 13 of file llips_general.h.

#define OFFSET_SIGN_size   2

Definition at line 19 of file llips_general.h.

#define PI   3.141592653589793

Definition at line 73 of file llips_general.h.

#define PIXEL_8bit_RANGE   255

Definition at line 29 of file llips_general.h.

#define PIXEL_size   1

Definition at line 24 of file llips_general.h.

#define RED   0x0100

Definition at line 34 of file llips_general.h.

#define SetRGB (   r,
  g,
 
)    ((0xFF&r)<<16) | ((0xFF&g)<<8 ) | (0xFF&b)

Definition at line 83 of file llips_general.h.

#define WIN_BMP   0x4D42

Definition at line 26 of file llips_general.h.

Typedef Documentation

typedef enum te_color e_color

Enumeration Type Documentation

enum te_color
Enumerator
c_Red 
c_Green 
c_Blue 
c_color_size 

Definition at line 37 of file llips_general.h.

Function Documentation

CPU_CHAR apply_linfilter ( t_img img_in,
CPU_FP64 **  tab_filtre,
CPU_INT16S  filtersize,
CPU_INT32U  color,
t_img img_out 
)

Apply a predefined filter on the image.

Parameters
img_int_img* - input image
tab_filtreCPU_FP64** - pointer to a 2D Table containing the filter
filtersizeCPU_INT16S - size of the matrix representing the filter
colorCPU_INT32U - color that will be impacted by the filter. If not selected, will be set to zero
img_outt_img* - output image
Returns
CPU_CHAR - status of operation

Definition at line 619 of file llips_general.c.

CPU_CHAR apply_median_filter ( t_img img_in,
CPU_INT16S  filtersize,
t_img img_out 
)

Apply a median filter on an image.

Parameters
img_int_img* - input image
filtersizeCPU_INT16S - filter size
img_outt_img* - output image
Returns
CPU_CHAR - status of operation

Creating a matrix is not necessary prior to use this filter

Definition at line 882 of file llips_general.c.

CPU_CHAR color_filter ( t_img img_in,
t_img img_out,
CPU_INT32U  color 
)

Create an image with only the color provided.

Parameters
img_int_img* - input image
img_outt_img* - output image
colorCPU_INT32U - range of color to work on
Returns
CPU_CHAR error

The parameter color must be a combination of RED | GREEN | BLUE

Definition at line 333 of file llips_general.c.

CPU_FP64 conv_gauss ( CPU_INT16S  x,
CPU_INT16S  y,
CPU_FP64  sig 
)

Gaussian convolution, used to create gaussian filter.

Parameters
xCPU_INT16S - coordinate x in the matrix
yCPU_INT16S - coordinate y in the matrix
sigCPU_FP64 - standard deviation of Gaussian distribution
Returns
CPU_FP64 - result

http://en.wikipedia.org/wiki/Gaussian_filter or http://fr.wikipedia.org/wiki/Filtre_de_Gauss

Definition at line 705 of file llips_general.c.

CPU_VOID create_average_filter ( CPU_FP64 **  tab_filtre,
CPU_INT16S  filtersize 
)

Create an average filter for smoothing.

Parameters
tab_filtreCPU_FP64** - pointer to a 2D table (matrix) that will receive the filter
filtersizeCPU_INT16S - size of the matrix
Returns
CPU_VOID

Definition at line 762 of file llips_general.c.

CPU_VOID create_gauss_filter ( CPU_FP64 **  tab_filtre,
CPU_INT16S  filtersize,
CPU_FP64  sigma 
)

Create a Gaussian filter used to smooth and image.

Parameters
tab_filtreCPU_FP64** - pointer to a 2D table (matrix) that will receive the filter
filtersizeCPU_INT16S - size of the matrix
sigmaCPU_FP64 - standard deviation of Gaussian distribution (higher will smooth more)
Returns
CPU_VOID

Definition at line 727 of file llips_general.c.

CPU_INT16S create_laplacian_filter ( CPU_FP64 **  tab_filtre,
CPU_INT08U  filtertype 
)

Create a laplacian filter for edge detection (return matrix must have a size of 3 or 5)

Parameters
tab_filtreCPU_FP64** - pointer to a 2D table (matrix) that will receive the filter of size (minimum size 3)
filtertypeCPU_INT16S - type of filter to use
Returns
CPU_INT16S - filter size

type 1 { 0,-1, 0} type 2 {0, 1, 0} {-1, 4,-1} {1,-4, 1} { 0,-1, 0} {0, 1, 0}

type 3 {-1,-1,-1} type 4 { 1,-2, 1} {-1, 8,-1} {-2, 4,-2} {-1,-1,-1} { 1,-2, 1}

type 5 { 0, 0,-1, 0, 0} { 0,-1,-2,-1, 0} {-1,-2,16,-2,-1} { 0,-1,-2,-1, 0} { 0, 0,-1, 0, 0}

Definition at line 797 of file llips_general.c.

CPU_VOID display_filter_value ( CPU_FP64 **  tab_filtre,
CPU_INT08U  filtersize 
)

Display values contained in a square filter.

Parameters
tab_filtreCPU_FP64** - pointer to matrix filter to display
filtersizeCPU_INT08U - Size of the filter
Returns
CPU_VOID

Definition at line 965 of file llips_general.c.

CPU_VOID display_img_value ( t_img img,
CPU_INT16S  colors 
)

Display each color of image in ascii.

Parameters
imgt_img* - image to display
colorsCPU_INT16S - color layer to display
Returns
CPU_VOID

Definition at line 96 of file llips_general.c.

CPU_INT08U get_median ( CPU_INT08U **  table2D,
CPU_INT16S  filter_range,
CPU_INT16S  i,
CPU_INT16S  j 
)

Calcultate the median value of an area surrounding a pixel.

Parameters
table2DCPU_INT08U** - pixel table
filter_rangeCPU_INT16S - size of the filter
iCPU_INT16S - coordinate of pixel
jCPU_INT16S - coordinate of pixel
Returns
CPU_INT08U - median value

Definition at line 939 of file llips_general.c.

CPU_VOID highlight_area ( t_img img,
t_area area,
CPU_INT32U  RGB 
)

Draw a rectangular area on image in a given color.

Parameters
imgt_img* - image to modify (also output)
areat_area* - area to highlight
RGBCPU_INT32U - highlight color
Returns
CPU_VOID

Helpfull macro to define color is SetRGB(r,g,b), with value between 0 and 255

Definition at line 278 of file llips_general.c.

t_vect highlight_line ( t_img img,
t_pixel  pix1,
t_pixel  pix2,
CPU_INT32U  RGB 
)

Draw a line on image in a given color.

Warning
NOT FUNCTIONNAL
Parameters
imgt_img* - image to modify (also output)
pix1t_pixel - first point of line
pix2t_pixel - second point of line
RGBCPU_INT32U - color of the line
Returns
t_vect - vector representing the line

Needs to be done Helpfull macro to define color is SetRGB(r,g,b), with value between 0 and 255

Definition at line 172 of file llips_general.c.

CPU_CHAR histogram ( t_img img_in,
t_img img_out 
)

Create an image with a view of histogram (RGBY).

Parameters
img_int_img* - input image
img_outt_img* - output image
Returns
CPU_CHAR - status of operation

Width and precision of histogram depend on image width

Definition at line 392 of file llips_general.c.

CPU_VOID init_area ( t_area area,
CPU_INT16U  maxwidth,
CPU_INT16U  maxheight 
)

Initialize an area from 0,0 to given values.

Parameters
areat_area* - pointer to initialized area
maxwidthCPU_INT16U - width of area
maxheightCPU_INT16U - height of area
Returns
CPU_VOID

Definition at line 255 of file llips_general.c.

CPU_CHAR luminance ( t_img img_in,
t_img img_out 
)

Create an image only luminance data (desaturated image)

Parameters
img_int_img* - input image
img_outt_img* - output image
Returns
CPU_CHAR - status of operation

Definition at line 571 of file llips_general.c.

t_area pixel_to_area ( t_pixel  pix)

Convert a pixel into a area of 1 x 1.

Parameters
pixt_pixel - pixel
Returns
t_area - corresponding area

This function is use to be able to draw a pixel using highlight_area() function

Definition at line 229 of file llips_general.c.

t_vect pixels_to_vector ( t_pixel  pix1,
t_pixel  pix2 
)

Convert two pixel into a vector.

Parameters
pix1t_pixel - starting point of vector
pix2t_pixel - ending point of vector
Returns
t_vect - corresponding vector between pix1 and pix2

Definition at line 192 of file llips_general.c.

CPU_VOID printf_area ( t_area area)

Display area corner coordonate in a console.

Parameters
areat_area* - area to display
Returns
CPU_VOID

Definition at line 309 of file llips_general.c.

CPU_INT16U vectormodule ( t_vect  vect)

Give module of a vector, in "pixel".

Parameters
vectt_vect - vector to process
Returns
CPU_INT16U - module of the vector

Definition at line 210 of file llips_general.c.