void outputEdge(char *fname,char *exten,unsigned char *RGB0,unsigned char *rmap,
    int ny,int nx,int status,int type,int dim,float displayintensity)
{
  int iy,ix,i,j,datasize,l1,l2,mapsize;
  char outfname[200];
  unsigned char *RGB;

  mapsize = ny*nx;
  datasize = ny*nx*dim;
  RGB = (unsigned char *) malloc(datasize*sizeof(unsigned char));
  for (i=0;i<datasize;i++) RGB[i] = RGB0[i]*displayintensity;

  l1 = 0;
  for (iy=0;iy<ny;iy++)
  {
    for (ix=0;ix<nx-1;ix++)
    {
      l2 = l1+1;
      if (rmap[l1]!=rmap[l2])
      {
        for (j=0;j<dim;j++) { RGB[dim*l1+j]=255; RGB[dim*l2+j]=255; }
      }
      l1++;
    }
    l1++;
  }
  l1 = 0;
  for (iy=0;iy<ny-1;iy++)
  {
    for (ix=0;ix<nx;ix++)
    {
      l2 = l1+nx;
      if (rmap[l1]!=rmap[l2])
      {
        for (j=0;j<dim;j++) { RGB[dim*l1+j]=255; RGB[dim*l2+j]=255; }
      }
      l1++;
    }
  }

  for (i=0;i<mapsize;i++)
  {
    if (rmap[i]==0)
    {
      for (j=0;j<dim;j++) RGB[dim*i+j]=0;
    }
  }

  if (status==-1) sprintf(outfname,"%s",fname);
  else sprintf(outfname,"%s.%d.seg.%s",fname,status,exten);

  outputresult(type,outfname,RGB,ny,nx,dim);

  free(RGB);
}
Exemple #2
0
int main() {
    int i , j , n , p , line_flag ;
    for ( i = 0 ; i < 100 ; i++ ) {
        for ( j = 0 ; j < 26 ; j++ ) 
            factor_result[i][j] == 0;
    }

    while ( scanf("%d", &n) != -1 ) { 
        if ( n == 0 )
            return 0;
        outputresult(n);
    }
    return 0;
}