Home | Develop | Download | Contact
example.c
1 #include <pds/pdsdic.h>
2 
3 void auxiliar_function(PdsMatrix **M0,PdsRegionRect *R0,PdsMatrix **M1);
4 
5 int main(int argc, char** argv)
6 {
7  int ID=0;
8  PdsMatrix *M0=NULL;
9  PdsMatrix *M1=NULL;
10  PdsRegionRect R0;
11 
12  // Step 0: Creating two random matrix with the same elements in the region R0
13  // of M0 and other region in M1.
14  auxiliar_function(&M0,&R0,&M1);
15 
16  // Step 1: Creating a DIC structure
18  if(DIC==NULL) return EXIT_FAILURE;
19 
20  // Step 2: Tracking the region
21  PdsRegionRect Rout;
22  ID=pds_dic2d_tracking_region(DIC,R0,&Rout);
23 
24  // Step 3: Managing the results
25  if(ID==PDS_DIC2D_FOUND) pds_region_rect_stylized_printf(Rout);
26  else printf("ERROR: In tracking.\n");
27 
28  // Step 4: Releasing the memory of DIC structure and setting DIC=NULL
29  pds_dic2d_destroy(&DIC);
30 
31  return 0;
32 }
33 
34 void auxiliar_function(PdsMatrix **M0,PdsRegionRect *R0,PdsMatrix **M1)
35 {
36  // Creating the matrix M0 and the region R0
37  (*M0)=pds_matrix_new_rand(600,800);
38  (*R0)=pds_region_rect(200,250,48,64);
39  pds_region_rect_stylized_printf((*R0));
40 
41  // Creating the matrix M1 and copying the region R0 to R1
42  (*M1)=pds_matrix_new_rand(600,800);
43  PdsRegionRect R1=pds_region_rect(210,230,48,64);
44  pds_matrix_copy_region_to_region((*M0),(*R0),(*M1),R1);
45  pds_region_rect_stylized_printf(R1);
46 
47  printf("\n");
48 }
La estructura tipo PdsDic2D . Esta estructura contiene dos matrices de Nlin lineas y Ncol columnas...
Definition: pdsdic2d.h:127
int pds_dic2d_tracking_region(PdsDic2D *DIC, PdsRegionRect Rin, PdsRegionRect *Rout)
Devuelve la región coincidente en la segunda matriz.
void pds_dic2d_destroy(PdsDic2D **DIC)
Libera la estructura de tipo puntero PdsDic2D, y limpia el puntero con NULL.
PdsDic2D * pds_dic2d_new_from_matrices(const PdsMatrix *Mat0, const PdsMatrix *Mat1)
Crea una estructura de tipo PdsDic2D, internamente la estructura contiene una copia de las dos matric...

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed