LLIPS  rev33
Light Library for Image ProcesS
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
llips_general.h
Go to the documentation of this file.
1 /********************************************/
7 #ifndef __LLIPS_GENERAL_H
8 #define __LLIPS_GENERAL_H
9 /* ***************************************************************/
10 /* * Define */
11 /* ***************************************************************/
12 /* Offset of different data field in BMP images */
13 #define OFFSET_SIGN 0x0000
14 #define OFFSET_IMG_P_DATA 0x000A
15 #define OFFSET_IMG_WIDTH 0x0012
16 #define OFFSET_IMG_HEIGHT 0x0016
17 #define OFFSET_IMG_DEPTH 0x001C
18 
19 #define OFFSET_SIGN_size 2
20 #define OFFSET_IMG_P_DATA_size 4
21 #define OFFSET_IMG_WIDTH_size 4
22 #define OFFSET_IMG_HEIGHT_size 4
23 #define OFFSET_IMG_DEPTH_size 2
24 #define PIXEL_size 1
25 
26 #define WIN_BMP 0x4D42
27 #define OFFSET_IMG_DATA_WIN24bit 0x0036
28 #define DEPTH_24bit 24
29 #define PIXEL_8bit_RANGE 255
30 
31 /* Color masks */
32 #define BLUE 0x0001
33 #define GREEN 0x0010
34 #define RED 0x0100
35 #define HEADER 0x1000
36 
37 typedef enum te_color
38 {
39  c_Red = 0,
40  c_Green = 1,
41  c_Blue = 2,
43 }e_color;
44 
45 /* Error management */
46 #define ERR_NONE 0x0000
47 #define ERR_NOFILE 0x0001
48 #define ERR_NOT_WINBMP 0x0002
49 #define ERR_NOT_24bit 0x0003
50 #define ERR_TOO_WIDTH 0x0004
51 #define ERR_TOO_HEIGHT 0x0005
52 #define ERR_HEADER_TOO_BIG 0x0006
53 #define ERR_OPENFILE 0x0007
54 
55 /* Color difference management */
56 #define NO_DIFF 0x0000
57 #define DIFF_SIZE 0x0001
58 #define DIFF_BLUE 0x0002
59 #define DIFF_GREEN 0x0004
60 #define DIFF_RED 0x0008
61 #define DIFF_HIGH_QUANTITY 0x0010
62 
63 /* Smoothing */
64 #define FILTER_SIZE_USER 15
65 
66 #if ((FILTER_SIZE_USER % 2) == 0)
67 #warning "Added 1 to FILTER_SIZE_USER"
68 #define FILTER_SIZE (FILTER_SIZE_USER + 1)
69 #else
70 #define FILTER_SIZE FILTER_SIZE_USER
71 #endif
72 
73 #define PI 3.141592653589793
74 
75 
76 /* ***************************************************************/
78 /* ***************************************************************/
79 /* Get and Set for getting specific primary color */
80 #define GetBlue(c) 0xFF&(c)
81 #define GetGreen(c) 0xFF&(c>>8)
82 #define GetRed(c) 0xFF&(c>>16)
83 #define SetRGB(r,g,b) ((0xFF&r)<<16) | ((0xFF&g)<<8 ) | (0xFF&b)
84 
85 /* ***************************************************************/
86 /* * Global variables */
87 /* ***************************************************************/
88 
89 
90 /* ***************************************************************/
91 /* * Prototypes */
92 /* ***************************************************************/
94 CPU_VOID init_area(t_area * area,CPU_INT16U maxwidth,CPU_INT16U maxheight);
101 CPU_CHAR color_filter(t_img * img_in,t_img * img_out, CPU_INT32U color);
102 CPU_CHAR histogram(t_img * img_in,t_img * img_out);
103 CPU_CHAR luminance(t_img * img_in,t_img * img_out);
104 CPU_CHAR apply_linfilter(t_img * img_in,CPU_FP64 ** tab_filtre,CPU_INT16S filtersize,CPU_INT32U color,t_img * img_out);
106 CPU_VOID create_gauss_filter(CPU_FP64 ** tab_filtre,CPU_INT16S filtersize,CPU_FP64 sigma);
107 CPU_VOID create_average_filter(CPU_FP64 ** tab_filtre,CPU_INT16S filtersize);
108 CPU_INT16S create_laplacian_filter(CPU_FP64 ** tab_filtre,CPU_INT08U filtertype);
109 CPU_CHAR apply_median_filter(t_img * img_in,CPU_INT16S filtersize,t_img * img_out);
110 CPU_INT08U get_median(CPU_INT08U ** table2D,CPU_INT16S filter_range,CPU_INT16S i, CPU_INT16S j);
111 CPU_VOID display_filter_value(CPU_FP64 ** tab_filtre,CPU_INT08U filtersize);
112 #endif
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) ...
CPU_VOID highlight_area(t_img *img, t_area *area, CPU_INT32U RGB)
Draw a rectangular area on image in a given color.
void CPU_VOID
Definition: llips_type.h:20
CPU_VOID init_area(t_area *area, CPU_INT16U maxwidth, CPU_INT16U maxheight)
Initialize an area from 0,0 to given values.
CPU_FP64 conv_gauss(CPU_INT16S x, CPU_INT16S y, CPU_FP64 sig)
Gaussian convolution, used to create gaussian filter.
CPU_VOID display_filter_value(CPU_FP64 **tab_filtre, CPU_INT08U filtersize)
Display values contained in a square filter.
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.
enum te_color e_color
double CPU_FP64
Definition: llips_type.h:30
te_color
Definition: llips_general.h:37
t_area pixel_to_area(t_pixel pix)
Convert a pixel into a area of 1 x 1.
t_vect pixels_to_vector(t_pixel pix1, t_pixel pix2)
Convert two pixel into a vector.
CPU_INT16U vectormodule(t_vect vect)
Give module of a vector, in "pixel".
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.
unsigned char CPU_CHAR
Definition: llips_type.h:21
CPU_VOID display_img_value(t_img *img, CPU_INT16S colors)
Display each color of image in ascii.
Definition: llips_general.c:96
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.
signed short CPU_INT16S
Definition: llips_type.h:26
unsigned long CPU_INT32U
Definition: llips_type.h:27
CPU_CHAR histogram(t_img *img_in, t_img *img_out)
Create an image with a view of histogram (RGBY).
CPU_CHAR apply_median_filter(t_img *img_in, CPU_INT16S filtersize, t_img *img_out)
Apply a median filter on an image.
CPU_VOID create_average_filter(CPU_FP64 **tab_filtre, CPU_INT16S filtersize)
Create an average filter for smoothing.
unsigned short CPU_INT16U
Definition: llips_type.h:25
CPU_CHAR luminance(t_img *img_in, t_img *img_out)
Create an image only luminance data (desaturated image)
unsigned char CPU_INT08U
Definition: llips_type.h:23
CPU_VOID printf_area(t_area *area)
Display area corner coordonate in a console.
CPU_CHAR color_filter(t_img *img_in, t_img *img_out, CPU_INT32U color)
Create an image with only the color provided.
CPU_VOID create_gauss_filter(CPU_FP64 **tab_filtre, CPU_INT16S filtersize, CPU_FP64 sigma)
Create a Gaussian filter used to smooth and image.