50 raw_quantity = ((img_in1->
he * img_in1->
wi)*quantity)/1000;
53 if((img_in1->
he == img_in2->
he) && (img_in1->
wi == img_in2->
wi))
64 img_out->
wi = img_in2->
wi;
65 img_out->
he = img_in2->
he;
69 for(i=0;i< img_in1->
he ;i++)
71 for(j=0 ; j< img_in1->
wi ;j++)
74 if (img_out->
Blue[i][j] > raw_tolerance)
79 if (img_out->
Green[i][j] > raw_tolerance)
84 if (img_out->
Red[i][j] > raw_tolerance)
89 if ((img_out->
Blue[i][j] > raw_tolerance) || (img_out->
Green[i][j] > raw_tolerance) || (img_out->
Red[i][j] > raw_tolerance))
92 img_out->
Blue[i][j] = img_in2->
Blue[i][j]/2;
93 img_out->
Red[i][j] = img_in2->
Red[i][j]/2;
94 quantity_of_diff_pixel ++;
109 img_out->
Blue[i][j] = img_in2->
Blue[i][j];
110 img_out->
Red[i][j] = img_in2->
Red[i][j];
119 if (quantity_of_diff_pixel > raw_quantity)
144 t_pixel temporary_pixel_1,temporary_pixel_2,temporary_pixel_3;
145 t_area area_1_center,area_2_center;
155 p_img_target->
wi = p_img_base->
wi;
156 p_img_target->
he = p_img_base->
he;
166 temporary_pixel_3.
x = p_img_base->
wi / 2;
167 temporary_pixel_3.
y = p_img_base->
he / 2;
169 area_1_center.
TopLeft.
x = temporary_pixel_1.
x - 1;
170 area_1_center.
TopLeft.
y = temporary_pixel_1.
y + 1;
171 area_1_center.
TopRight.
x = temporary_pixel_1.
x + 1;
172 area_1_center.
TopRight.
y = temporary_pixel_1.
y + 1;
173 area_1_center.
BotLeft.
x = temporary_pixel_1.
x - 1;
174 area_1_center.
BotLeft.
y = temporary_pixel_1.
y - 1;
175 area_1_center.
BotRight.
x = temporary_pixel_1.
x + 1;
176 area_1_center.
BotRight.
y = temporary_pixel_1.
y - 1;
178 area_2_center.
TopLeft.
x = temporary_pixel_2.
x - 1;
179 area_2_center.
TopLeft.
y = temporary_pixel_2.
y + 1;
180 area_2_center.
TopRight.
x = temporary_pixel_2.
x + 1;
181 area_2_center.
TopRight.
y = temporary_pixel_2.
y + 1;
182 area_2_center.
BotLeft.
x = temporary_pixel_2.
x - 1;
183 area_2_center.
BotLeft.
y = temporary_pixel_2.
y - 1;
184 area_2_center.
BotRight.
x = temporary_pixel_2.
x + 1;
185 area_2_center.
BotRight.
y = temporary_pixel_2.
y - 1;
216 CPU_INT16U quantity_of_diff_pixel = 0,module=0;
222 raw_quantity = ((img_in1->
he * img_in1->
wi)*quantity)/1000;
225 if((img_in1->
he == img_in2->
he) && (img_in1->
wi == img_in2->
wi))
236 img_out->
wi = img_in2->
wi;
237 img_out->
he = img_in2->
he;
241 for(i=0;i< img_in1->
he ;i++)
243 for(j=0 ; j< img_in1->
wi ;j++)
246 if (img_out->
Blue[i][j] > raw_tolerance)
251 if (img_out->
Green[i][j] > raw_tolerance)
256 if (img_out->
Red[i][j] > raw_tolerance)
261 if ((img_out->
Blue[i][j] > raw_tolerance) || (img_out->
Green[i][j] > raw_tolerance) || (img_out->
Red[i][j] > raw_tolerance))
264 img_out->
Blue[i][j] = 0;
265 img_out->
Red[i][j] = 0;
266 quantity_of_diff_pixel ++;
268 if(((i>15)&&(j>15))&&((i<img_in2->
he)&&(j<img_in2->wi)))
271 change_img->
BotLeft.
x = j - areasize /2 ;
272 change_img->
BotLeft.
y = i + areasize /2 ;
273 change_img->
BotRight.
x = j + areasize /2 ;
274 change_img->
BotRight.
y = i - areasize /2 ;
275 change_img->
TopLeft.
x = j + areasize /2 ;
276 change_img->
TopLeft.
y = i - areasize /2 ;
277 change_img->
TopRight.
x = j - areasize /2 ;
278 change_img->
TopRight.
y = i + areasize /2 ;
283 area2 =
look_for_match(img_in1,img_in2,areasize,area1,raw_tolerance);
284 if ((area2.
x != 0)&&(area2.
y != 0))
287 maxmodule =
maxi(module,maxmodule);
289 area_pic2.
BotLeft.
x = area2.
x - areasize /2 ;
290 area_pic2.
BotLeft.
y = area2.
y + areasize /2 ;
291 area_pic2.
BotRight.
x = area2.
x + areasize /2 ;
292 area_pic2.
BotRight.
y = area2.
y - areasize /2 ;
293 area_pic2.
TopLeft.
x = area2.
x + areasize /2 ;
294 area_pic2.
TopLeft.
y = area2.
y - areasize /2 ;
295 area_pic2.
TopRight.
x = area2.
x - areasize /2 ;
296 area_pic2.
TopRight.
y = area2.
y + areasize /2 ;
306 img_out->
Green[i][j] = 0;
307 img_out->
Blue[i][j] = 0;
308 img_out->
Red[i][j] = 0;
312 printf(
"maxmodule : %d\n",maxmodule);
318 if (quantity_of_diff_pixel > raw_quantity)
352 for(i=0;i< areasize ;i++)
354 for(j=0 ; j< areasize ;j++)
356 table_src[i][j] = img_in1->
Green[i+(area_from_1.
y - areasize / 2)][j+(area_from_1.
x - areasize / 2)];
362 for( offset_i=(0-(range_i/2)); offset_i< (range_i/2) ;offset_i++)
364 for(offset_j=0;offset_j> (0 - range_j) ;offset_j--)
367 for(i=0;i< areasize ;i++)
369 for(j=0 ; j< areasize ;j++)
371 table_dest[i][j] = img_in2->
Green[i+(area_from_1.
y - areasize / 2)+offset_i][j+(area_from_1.
x - areasize / 2)+offset_j];
376 for(i=0;i< areasize ;i++)
378 for(j=0 ; j< areasize ;j++)
380 if ((abs(table_dest[i][j] - table_src[i][j]))>(raw_tolerance*3)/2)
388 area_to_2.
x = area_from_1.
x + offset_j;
389 area_to_2.
y = area_from_1.
y + offset_i;
394 if(match ==
TRUE)
break;
396 if(match ==
TRUE)
break;
CPU_VOID init_area(t_area *area, CPU_INT16U maxwidth, CPU_INT16U maxheight)
Initialize an area from 0,0 to given values.
t_pixel look_for_match(t_img *img_in1, t_img *img_in2, CPU_INT16U areasize, t_pixel area_from_1, CPU_INT16U raw_tolerance)
Try to find a correspondance from an area from image 1 in image 2.
CPU_INT08U FileHeader_size
CPU_INT32U maxi(CPU_INT32U a, CPU_INT32U b)
compare two CPU_INT32U to find the biggest
CPU_CHAR search_diff(CPU_INT16U tolerance, CPU_INT16U quantity, t_img *img_in1, t_img *img_in2, t_img *img_out, t_area *change_img)
Search for difference between two images, using given tolerance and quantity change criteria...
CPU_INT16U vectormodule(t_vect vect)
Give module of a vector, in "pixel".
t_vect pixels_to_vector(t_pixel pix1, t_pixel pix2)
Convert two pixel into a vector.
#define DIFF_HIGH_QUANTITY
Global include file for LLIPS.
CPU_VOID highlight_area(t_img *img, t_area *area, CPU_INT32U RGB)
Draw a rectangular area on image in a given color.
CPU_CHAR search_diff_x(CPU_INT16U tolerance, CPU_INT16U quantity, t_img *img_in1, t_img *img_in2, t_img *img_out, t_area *change_img)
Search for difference between two images, using given tolerance and quantity change criteria...
unsigned char CPU_BOOLEAN
CPU_INT08U ** createTableINT08U(CPU_INT16S nbLin, CPU_INT16S nbCol)
Allocate memory for a CPU_INT08U 2D table.
CPU_INT32U mini(CPU_INT32U a, CPU_INT32U b)
Compare two CPU_INT32U to find the smallest.
CPU_INT08U FileHeader[MAX_HEADER_size]
unsigned short CPU_INT16U
t_vect evaluate_move(t_img *p_img_base, t_img *p_img_target, t_area area_1, t_area area_2, t_vect *p_movement_origin)
Evaluate mouvement direction between three sequencial images that have been previously processed by s...