コード例 #1
0
ファイル: grib_query.c プロジェクト: mikloserik/licenta
static void visit(grib_section* s,const char* name,const char* name_space,
        search_all_callback_proc callback,void *data,int* count)
{
    grib_accessor* a = s ? s->block->first : NULL;

    if(!s) return ;

    while(a)
    {
        grib_section* sub = a->sub_section;

        if(matching(a,name,name_space))
        {
            callback(a,data);
            (*count)++;
        }

        visit(sub,name,name_space,callback,data,count);

        a = a->next;
    }
}
コード例 #2
0
ファイル: grib_query.c プロジェクト: mikloserik/licenta
static grib_accessor* search_and_cache(grib_handle* h, const char* name,const char *the_namespace)
{
    if(h->use_trie)
    {
        grib_accessor* a = NULL;
        int id=-1;

        if (h->trie_invalid && h->kid == NULL)
        {
            int i=0;
            for (i=0;i<ACCESSORS_ARRAY_SIZE;i++)
                h->accessors[i]=NULL;

            if (h->root)
                rebuild_hash_keys(h,h->root);

            h->trie_invalid=0;
            id = grib_hash_keys_get_id(h->context->keys,name);

        }
        else
        {
            id = grib_hash_keys_get_id(h->context->keys,name);

            if ((a=h->accessors[id])!=NULL && (the_namespace==NULL || matching(a,name,the_namespace)))
                return a;
        }

        a = search(h->root,name,the_namespace);
        h->accessors[id] = a;

        return a;
    }
    else {
        return search(h->root,name,the_namespace);
    }
}
コード例 #3
0
ファイル: grib_query.c プロジェクト: mikloserik/licenta
static grib_accessor* search(grib_section* s,const char* name,const char* name_space)
{
    grib_accessor* match = NULL;

    grib_accessor* a = s ? s->block->first : NULL;
    grib_accessor* b=NULL;

    if(!a || !s) return NULL;

    while(a)
    {
        grib_section* sub = a->sub_section;

        if(matching(a,name,name_space))
            match = a;

        if((b = search(sub,name,name_space)) != NULL)
            match = b;

        a = a->next;
    }

    return match;
}
コード例 #4
0
void main()
{

 int gdriver = DETECT, gmode, errorcode;
 char stylestr[40];
  int adja[20][20],diff[20],t=0;
 int i=0,j,row,col,counter=0,no=0;
 int count1=0,count2=0,f=0,r=0,z=0;
 int u=0,h=0;
 char vertices[20],ch;
 char edges[200],gr;
 /* p is a pointer used to access every element of edges array */
 char *p;
 int k=0;
 int deg[20],arr[20][20];
 int midx,midy,maxx,maxy,maxcol;

 /* initialize graphics and local variables */
 initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
  /* read result of initialization */
 errorcode = graphresult();

 if (errorcode != grOk)  /* an error occurred */
  {
   printf("Graphics error: %s\n", grapherrormsg(errorcode));
   printf("Press any key to halt:");
   getch();
   exit(1); /* terminate with an error code */
  }



/* edges array takes a set of edges as input,
   adja is used for adjacency matrix, counter contains the no. of edges in
   the graph, vertices array consists of the vertices in the graph */




 midx = getmaxx() / 2;
 midy = getmaxy() / 2;
 maxx = getmaxx();
 maxy = getmaxy();
 maxcol= getmaxcolor();

clrscr();
 /*vertices array initialised to character '0' so that it doesn't contain
   any garbage value */

for(i=0;i<20;i++)
{
 vertices[i]='0';
}

/* adja array is initialised to 0
   so that it doesn't contain any garbage value */

for(i=0;i<20;i++)
{
 for(j=0;j<20;j++)
 {
  adja[i][j]=0;
 }
}
for(i=0;i<20;i++)
{
 diff[i]=0;

}

intro();

 getch();
 clrscr();

setfillstyle(10, maxcol);
 /* fill the screen with the pattern */
 bar(0, 0,maxx, midy/4-5);
 bar(0, 0,midx/4-15, maxy);
 bar(0, 7*midy/4-25,maxx, maxy);
 bar(7*midx/4+15, 0,maxx, maxy);
 setfillstyle(0, maxcol);
 bar(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25)  ;
 rectangle(midx/4-10,midy/4,7*midx/4+10,7*midy/4-30)  ;
 rectangle(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25)  ;
 settextjustify(CENTER_TEXT, CENTER_TEXT);
 settextstyle(1, HORIZ_DIR, 3);

 outtextxy(250,100,"Enter the set of edges....");
 settextstyle(2, HORIZ_DIR, 5);
 outtextxy(330,125,"(as in following manner..{a-b,b-c,c-d,d-a,a-c})");
 outtextxy(330,137,"(please ensure the small letters, comma,");
 outtextxy(330,149,"bar between letters and curly braces.)");
 gotoxy(15,13);
 gets(edges);
 settextstyle(1, HORIZ_DIR, 1);
 outtextxy(230,242,"Is it a directed graph?") ;
 gotoxy(50,16) ;
 scanf("%c",&gr);

 getch();
 clrscr();

p=&edges[1];
i=0;
j=0;



 /*entering vertices in vertices array after scanning the set of edges
  and simultaniously making adjacency matrix */

while(1)
 {
  if(('a'<=(*p))&&((*p)<='z'))
  {
   while(vertices[i]!='0')
   {
    i++;
   }
   vertices[i]=*p;
   row=i;
   for(j=0;j<i;j++)
   {
    if(vertices[j]==vertices[i])
    {
     vertices[i]='0';
     row=j;
     break;
    }
   }

   i=0;
   p=p+2;
   while(vertices[i]!='0')
   {
    i++;
   }
   vertices[i]=*p;
   col=i;
   for(j=0;j<i;j++)
   {
    if(vertices[j]==vertices[i])
    {
     vertices[i]='0';
     col=j;
     break;
    }
   }
  if(gr=='y')
  adja[row][col]=1;

  if(gr=='n')
  {
   adja[row][col]=1;
   adja[col][row]=1;
   }
  counter=counter+1;

  }
  p=p+1;
  if(*p==',')
  {

   p=p+1;

   continue;
  }
  if(*p=='}')
  break;
 }
 /* finished the task of making adjacency matrix and vertices array */
for(i=0;i<20;i++)
{
 if(vertices[i]!='0')
  {
   no=no+1;
  }
 }
 setfillstyle(10, maxcol);
 /* fill the screen with the pattern */
 bar(0, 0,maxx, midy/4-5);
 bar(0, 0,midx/4-15, maxy);
 bar(0, 7*midy/4-25,maxx, maxy);
 bar(7*midx/4+15, 0,maxx, maxy);
 setfillstyle(0, maxcol);
 bar(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25)  ;
 rectangle(midx/4-10,midy/4,7*midx/4+10,7*midy/4-30)  ;
 rectangle(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25)  ;

 settextjustify(CENTER_TEXT, CENTER_TEXT);
 settextstyle(1, HORIZ_DIR, 2);
 outtextxy(330,129,"Your graph has   vertices and   edges.");
 settextstyle(2, HORIZ_DIR, 5);
 outtextxy(330,179,"Do you wish to continue to have a look of adjancy matrix?");
 gotoxy(38,9);
 printf("%d",no);
 gotoxy(57,9);
 printf("%d",counter);


 getch();
 clrscr();

 setfillstyle(10, maxcol);
 /* fill the screen with the pattern */
 bar(0, 0,maxx, midy/4-5);
 bar(0, 0,midx/4-15, maxy);
 bar(0, 7*midy/4-15,maxx, maxy);
 bar(7*midx/4+15, 0,maxx, maxy);
 setfillstyle(0, maxcol);
 bar(midx/4-15,midy/4-5,7*midx/4+25,7*midy/4-15)  ;
 rectangle(midx/4-10,midy/4,7*midx/4+20,7*midy/4-20)  ;
 rectangle(midx/4-15,midy/4-5,7*midx/4+25,7*midy/4-15)  ;

 settextjustify(CENTER_TEXT, CENTER_TEXT);
 settextstyle(1, HORIZ_DIR, 3);
 outtextxy(330,110,"THE ADJACENCY MATRIX ");

gotoxy(24,15);
for(i=0;i<no;i++)
  {
  u=u+3;
  gotoxy(24,10+u);
  printf("%c",vertices[i]);
  }
  for(i=0;i<no;i++)
  {
  h=h+5 ;
  gotoxy(24+h,10);
  printf("%c",vertices[i]);
  }
  u=0;

for(i=0;i<no;i++)
{
  h=0;
  u=u+3;
  gotoxy(29,5+u);
  for(j=0;j<no;j++)
  {

   gotoxy(29+h,10+u);
   printf("%d",adja[i][j]);
   h=h+5;
  }
 }
 getch();
 clrscr();

 /* checking whether the graph is directed or not */
 if(gr=='y')
 {

  /* calculating the outgoing degree of every vertex in count1
    and incoming degree of every vertex in count2*/

   for(i=0;i<no;i++)
  {
   count1=0;
   count2=0;
   for(j=0;j<no;j++)
   {
    if(adja[i][j]==1)
     {

     count1=count1+1;
     }

   }
   for(j=0;j<no;j++)
   {
    if(adja[j][i]==1)
     count2=count2+1;
   }

     /* diff[] array consists of the difference of the incoming and
      outgoing degree of every vertex */

    diff[i]=count1-count2;

  }
  /* if the diff. of incoming  and outgoing degree of every vertex is 0
     euler circuit exists */
  for(i=0;i<no;i++)
  {
   if(diff[i]==0)
    {
     /* f is used for calculating the no. of vertices with 0
    difference in outgoing and incoming degree*/

     f=f+1;

    }
   }
   for(i=0;i<no;i++)
   {

    /* difference is 1 and -1 for 2 vertices and all the diff. are 0
     euler path exists */

   if(diff[i]==1)
   {
    r=r+1;
    k=i;

   }
   if(diff[i]==-1)
   {
   z=z+1;
   }
   }
  setfillstyle(10, maxcol);
    /* fill the screen with the pattern */
    bar(0, 0,maxx, midy/4-5);
    bar(0, 0,midx/4-15, maxy);
    bar(0, 7*midy/4-25,maxx, maxy);
    bar(7*midx/4+15, 0,maxx, maxy);
    setfillstyle(0, maxcol);
    bar(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25)  ;
    rectangle(midx/4-10,midy/4,7*midx/4+10,7*midy/4-30)  ;
    rectangle(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25)  ;

    settextjustify(CENTER_TEXT, CENTER_TEXT);
    settextstyle(1, HORIZ_DIR, 2);
    outtextxy(330,129,"and the degree of vertices are...");

  u=0;
  for(i=0;i<no;i++)
  {
  u=u+2;
  gotoxy(30,10+u);
  printf("%c",vertices[i]);

  gotoxy(45,10+u);
  printf("%d",diff[i]);

  }
 getch();
 clrscr();


  setfillstyle(10, maxcol);
  /* fill the screen with the pattern */
  bar(0, 0,maxx, midy/4-5);
  bar(0, 0,midx/4-15, maxy);
  bar(0, 7*midy/4-25,maxx, maxy);
  bar(7*midx/4+15, 0,maxx, maxy);
  setfillstyle(0, maxcol);
  bar(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25)  ;
  rectangle(midx/4-10,midy/4,7*midx/4+10,7*midy/4-30)  ;
  rectangle(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25)  ;
  settextjustify(CENTER_TEXT, CENTER_TEXT);
  settextstyle(1, HORIZ_DIR, 2);


 if(f==no)
 {
  outtextxy(330,170,"EULER CIRCUIT EXISTS!!!");

 /* t is an indicator showing whether a euler circuit or path
   exists or not */
 t=1;
 }
 if((r==1)&&(f==(no-2))&&(z==1))
 {
  outtextxy(330,170,"EULER PATH EXISTS!!!");
 t=1;
 }
 if(t==0)
 {
  outtextxy(330,200,"NEITHER EULER CIRCUIT NOR EULER PATH EXISTS");
 }


 if(t==1)
 {
  /* function for finding the euler path or circuit if exists */

  euler_path(&adja[0][0],counter,no,k,vertices,gr);
  }
 }
r=0;
f=0;

 /* finding euler path or circuit for undirected graph */

if(gr=='n')
{
 for(i=0;i<no;i++)
 {

  count1=0;
  for(j=0;j<no;j++)
  {
   if(adja[j][i]==1)
   {
    count1=count1+1;
   }
  }
   deg[i]=count1;
  if((count1%2)==0)
  {
  f=f+1;
  }
  else
  {
   r=r+1;

  }
 }
setfillstyle(10, maxcol);
 /* fill the screen with the pattern */
 bar(0, 0,maxx, midy/4-5);
 bar(0, 0,midx/4-15, maxy);
 bar(0, 7*midy/4-25,maxx, maxy);
 bar(7*midx/4+15, 0,maxx, maxy);
 setfillstyle(0, maxcol);
 bar(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25)  ;
 rectangle(midx/4-10,midy/4,7*midx/4+10,7*midy/4-30)  ;
 rectangle(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25)  ;

 settextjustify(CENTER_TEXT, CENTER_TEXT);
 settextstyle(1, HORIZ_DIR, 2);

 if(f==no)
  {
  t=1;
      outtextxy(330,170,"EULER CIRCUIT EXISTS!!!");
  }
 if((r==2)&&(f==(no-2)))
 {
 t=1;
  outtextxy(330,170,"EULER PATH EXISTS!!");
 }
 if(t==0)
 {
  outtextxy(330,200,"NEITHER EULER CIRCUIT NOR EULER PATH EXISTS");
 }
 if(t==1)
 {
 euler_path(&adja[0][0],counter,no,k,vertices,gr);
 }

}
getch();
setfillstyle(10, maxcol);
 /* fill the screen with the pattern */
 bar(0, 0,maxx, midy/4-5);
 bar(0, 0,midx/4-15, maxy);
 bar(0, 7*midy/4-25,maxx, maxy);
 bar(7*midx/4+15, 0,maxx, maxy);
 setfillstyle(0, maxcol);
 bar(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25)  ;
 rectangle(midx/4-10,midy/4,7*midx/4+10,7*midy/4-30)  ;
 rectangle(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25)  ;

 settextjustify(CENTER_TEXT, CENTER_TEXT);
 settextstyle(1, HORIZ_DIR, 2);

/*finding whether hamiltonian path exists or not*/
if(gr=='n')
{
 for(i=0;i<=no-1;i++)
 {
  for(j=i+1;j<=no-1;j++)
  {
   if((deg[i]+deg[j])>=no-1)
     continue;
   else
   {

     outtextxy(330,170,"HAMILTONIAN PATH MAY OR MAY NOT EXIST");
	settextstyle(2, HORIZ_DIR, 5);
	outtextxy(330,230,"(Since finding the hamiltonian path is a ");
	outtextxy(330,245,"incomplete problemso it would be appropriate");
	outtextxy(330,260,"to say the above statment.)") ;
       //	 getch();
	// clrscr();
	 goto pos;
   }
  }
 }
 if(i==no)
 {

   outtextxy(330,170,"HAMILTONIAN PATH EXISTS!!!");
  hamilton_path(&adja[0][0],no,vertices);

 }
  /* to check whether hamiltonian circuit exists or not*/
  for(i=0;i<20;i++)
  {
   for(j=0;j<20;j++)
   {
     arr[i][j]=100;
   }
  }
  for(i=0;i<no;i++)
  {
   int k=0;
   for(j=0;j<no;j++)
   {
    if((adja[i][j]!=0)||(i==j))
      continue;
    else
    {
      arr[i][k]=j;
      //printf("%d\t",arr[i][k]);
      k++;
    }
   }
 }
 for(i=0;i<no;i++)
 {
   for(k=0;arr[i][k]!=100;k++)
   {
     if((deg[i]+deg[arr[i][k]])>=no)
       continue;
     else
     {

      outtextxy(330,170,"HAMILTONIAN PATH MAY OR MAY NOT EXIST");
	  settextstyle(2, HORIZ_DIR, 5);
	  outtextxy(330,230,"(Since finding the hamiltonian path is a ");
	  outtextxy(330,245,"incomplete problemso it would be appropriate");
	  outtextxy(330,260,"to say the above statment.)") ;


       goto pos;
     }
   }
 }
 if(i==no)
 {


     outtextxy(330,170,"HAMILTONIAN PATH EXISTS!!!");

 }
   pos:


}

getch();
clrscr();
matching(vertices,no,&adja[0][0]);
getch();
clrscr();
color(vertices,no,&adja[0][0]);
getch();
clrscr();
cover(vertices,no,&adja[0][0]);


getch();
}


void matching(char *vertices, int no,int *x)
{
int i,h=0,j,k,n,v,w=0,arr1[20];
int midx,midy,maxx,maxy,maxcol;
midx = getmaxx() / 2;
 midy = getmaxy() / 2;
 maxx = getmaxx();
 maxy = getmaxy();
 maxcol= getmaxcolor();

for(i=0;i<no;i++)
{
arr1[i]=-1;
}

setfillstyle(10, maxcol);
 /* fill the screen with the pattern */
 bar(0, 0,maxx, midy/4-5);
 bar(0, 0,midx/4-15, maxy);
 bar(0, 7*midy/4-25,maxx, maxy);
 bar(7*midx/4+15, 0,maxx, maxy);
 setfillstyle(0, maxcol);
 bar(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25)  ;
 rectangle(midx/4-10,midy/4,7*midx/4+10,7*midy/4-30)  ;
 rectangle(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25)  ;


settextjustify(CENTER_TEXT, CENTER_TEXT);
 settextstyle(1, HORIZ_DIR, 4);

outtextxy(330,130,"MATCHING");

settextstyle(2, HORIZ_DIR, 5);
	  outtextxy(330,170,"(It represnt the subset of edges that are ");
	  outtextxy(330,185,"not adjacent to each other");

for(i=0;i<no;i++)
 {
  n=0;
  for(k=0;k<no;k++)
  {
  if(i==arr1[k])
  {
  n=1;
  break;

   }
  }
  if(n==1)
  continue;

  for(j=0;j<no;j++)
  {
   v=0;
  for(k=0;k<no;k++)
  {
  if(j==arr1[k])
  {
  v=1;
  break;
  }
  }
   if(v==1)
   continue;

   if((*(x+i*20+j))==1)
   {

   arr1[w]=i;
   w++;
   arr1[w]=j;
   w++;
   gotoxy(25,15+h);
   printf("%c   -   %c :",vertices[i],vertices[j]);
   h=h+2;
  *(x+i*20+j)= -1;
  *(x+j*20+i)= -1;

   break;
   }
  }

  }
 for(i=0;i<no;i++)
 {
 for(j=0;j<no;j++)
  {
   if((*(x+i*20+j))==-1)
    {
    (*(x+i*20+j))=1;
    (*(x+j*20+i))=1;
   }
   }
   }
}
コード例 #5
0
RML_END_LABEL

RML_BEGIN_LABEL(BackendDAEEXT__matching)
{
  int i=0;
  int nvars = RML_UNTAGFIXNUM(rmlA0);
  int neqns = RML_UNTAGFIXNUM(rmlA1);
  int matchingID = RML_UNTAGFIXNUM(rmlA2);
  int cheapID = RML_UNTAGFIXNUM(rmlA3);
  double relabel_period = RML_UNTAGFIXNUM(rmlA4);
  int clear_match = RML_UNTAGFIXNUM(rmlA5);

  if (clear_match==0){
    if (neqns>n) {
      int* tmp = (int*) malloc(neqns * sizeof(int));
      if(match)
      {
        memcpy(tmp,match,n*sizeof(int));
        free(match);
        match = tmp;
    for (i = n; i < neqns; i++) {
      match[i] = -1;
    }
      } else {
         match = (int*) malloc(neqns * sizeof(int));
         memset(match,-1,neqns * sizeof(int));
      }
      n = neqns;
    }
    if (nvars>m) {
      int* tmp = (int*) malloc(nvars * sizeof(int));
      if(row_match)
      {
        memcpy(tmp,row_match,m*sizeof(int));
        free(row_match);
        row_match = tmp;
    for (i = m; i < nvars; i++) {
      row_match[i] = -1;
    }
      } else {
        row_match = (int*) malloc(nvars * sizeof(int));
         memset(row_match,-1,nvars * sizeof(int));
      }
      m = nvars;
    }
  }
  else {
  if (neqns>n) {
      if (match) free(match);
      match = (int*) malloc(neqns * sizeof(int));
      memset(match,-1,neqns * sizeof(int));
  } else {
      memset(match,-1,n * sizeof(int));
  }
    n = neqns;
    if (nvars>m) {
      if (row_match) free(row_match);
      row_match = (int*) malloc(nvars * sizeof(int));
      memset(row_match,-1,nvars * sizeof(int));
    } else {
      memset(row_match,-1,m * sizeof(int));
    }
    m = nvars;
  }
  if ((match != NULL) && (row_match != NULL)) {
    matching(col_ptrs,col_ids,match,row_match,neqns,nvars,matchingID,cheapID,relabel_period,clear_match);
  }
  RML_TAILCALLK(rmlSC);
}
コード例 #6
0
    void
    testit(const std::vector<Plane> & gt_planes, const cv::Mat & gt_plane_mask, const cv::Mat & points3d,
           cv::RgbdPlane & plane_computer, float thresh)
    {
        for (char i_test = 0; i_test < 2; ++i_test)
        {
            cv::TickMeter tm1, tm2;
            cv::Mat plane_mask;
            std::vector<cv::Vec4f> plane_coefficients;

            if (i_test == 0)
            {
                tm1.start();
                // First, get the normals
                int depth = CV_32F;
                cv::RgbdNormals normals_computer(H, W, depth, K, 5, cv::RgbdNormals::RGBD_NORMALS_METHOD_FALS);
                cv::Mat normals;
                normals_computer(points3d, normals);
                tm1.stop();

                tm2.start();
                plane_computer(points3d, normals, plane_mask, plane_coefficients);
                tm2.stop();
            }
            else
            {
                tm2.start();
                plane_computer(points3d, plane_mask, plane_coefficients);
                tm2.stop();
            }

            // Compare each found plane to each ground truth plane
            size_t n_planes = plane_coefficients.size();
            size_t n_gt_planes = gt_planes.size();
            cv::Mat_<int> matching(n_gt_planes, n_planes);
            for (size_t j = 0; j < n_gt_planes; ++j)
            {
                cv::Mat gt_mask = gt_plane_mask == j;
                int n_gt = cv::countNonZero(gt_mask);
                int n_max = 0, i_max = 0;
                for (size_t i = 0; i < n_planes; ++i)
                {
                    cv::Mat dst;
                    cv::bitwise_and(gt_mask, plane_mask == i, dst);
                    matching(j, i) = cv::countNonZero(dst);
                    if (matching(j, i) > n_max)
                    {
                        n_max = matching(j, i);
                        i_max = i;
                    }
                }
                // Get the best match
                ASSERT_LE(float(n_max - n_gt) / n_gt, 0.001);
                // Compare the normals
                cv::Vec3d normal(plane_coefficients[i_max][0], plane_coefficients[i_max][1], plane_coefficients[i_max][2]);
                ASSERT_GE(std::abs(gt_planes[j].n.dot(normal)), 0.95);
            }

            std::cout << " Speed: ";
            if (i_test == 0)
                std::cout << "normals " << tm1.getTimeMilli() << " ms and ";
            std::cout << "plane " << tm2.getTimeMilli() << " ms " << std::endl;
        }
    }
コード例 #7
0
ファイル: pracaoc.cpp プロジェクト: anbarquer/matriculas
pracAOC::pracAOC(int argc, char ** argv): QWidget()
{
	mainWin=new QMainForm();
	mainWin->setupUi(this);
	path= new QString (argv[0]);
	path->chop(7);
	ctable.resize(256);
	for(int i=0; i < 256; i++)
		ctable[i] = qRgb(i,i,i);

	imgO=new uchar[320*100]; // matriz de imagen origen
	imgM=new uchar[320*100]; // se usa solo para mostrar datos
	imgD=new uchar[320*100]; // matriz de imagen destino de los procesos

	for (int i=0; i<7;i++)
		imgdigit[i]=new uchar[32*55]; //grupo de siete matrices para matching final

	qimgOrig = new QImage(imgO,320, 100, QImage::Format_Indexed8);
	qimgOrig->setColorTable(ctable);
	qimgOrig->setNumColors(256);

	qimgDest = new QImage(imgM,320, 100, QImage::Format_Indexed8);
	qimgDest->setColorTable(ctable);
	qimgDest->setNumColors(256);

	for (int i=0; i<7; i++){
	qimgDigit[i] = new QImage(imgdigit[i],32, 55, QImage::Format_Indexed8);
	qimgDigit[i]->setColorTable(ctable);
	qimgDigit[i]->setNumColors(256);
	}


    for (int i=0; i<320;i++) Vhor[i]=0; //guarda al integral proyectiva de cada columna

    Hmin=0;  //almacena la fila inferior y superior donde se encuentra los caracteres
    Hmax=0;

    for (int j=0; j<7;j++)
    	for(int i=0; i<32*55;i++)
    		imgdigit[j][i]=0;

	for(int i=0; i<320*100;i++)
	{
		imgO[i]=0;
		imgM[i]=0;
		imgD[i]=0;
	}
    init_digit();
    v=0;

	connect ( mainWin->pushButtonCargar, SIGNAL (clicked()), this, SLOT( cargar() ) );
	connect ( mainWin->pushButtonCopiarO, SIGNAL (clicked()), this, SLOT( copiarOrigen() ) );
	connect ( mainWin->pushButtonCopiarD, SIGNAL (clicked()), this, SLOT( copiarDestino() ) );
	connect ( mainWin->pushButtonBorrar, SIGNAL (clicked()), this, SLOT( borrar() ) );	
	connect ( mainWin->pushButtonNegar, SIGNAL (clicked()), this, SLOT( negar() ) );
	connect ( mainWin->pushButtonUmbralizar, SIGNAL (clicked()), this, SLOT( umbralizar() ) );
	connect ( mainWin->pushButtonDetectarV, SIGNAL (clicked()), this, SLOT( detectarv() ) );
	connect ( mainWin->pushButtonDetectarH, SIGNAL (clicked()), this, SLOT( detectarh() ) );
	connect ( mainWin->pushButtonRecortar, SIGNAL (clicked()), this, SLOT( recortar() ) );
	connect ( mainWin->pushButtonMatching, SIGNAL (clicked()), this, SLOT( matching() ) );
	connect ( mainWin->pushButtonTodo, SIGNAL (clicked()), this, SLOT( TODO() ) );
	connect ( mainWin->pushButtonSalir, SIGNAL (clicked()), this, SLOT( close() ) );

}