imageprocessing/guidedVectorize.c
void showNeighborhood(BYTE* image,int width, int height,
		      int centerx, int centery, int tolerance, int x, int y)
{
  int r=0;  /* row counter */
  int c=0;  /* column counter */
  int curx;
  int cury; 
  int bShow = 0;
  char buffer[32];
  if ((x >= 0) && (y >= 0))
    {
    curx = x - centerx;
    cury = y - centery;
    bShow = 1;
    printf("x=%d, curx=%d, y=%d, cury=%d\n",x,curx,y,cury);
    }
  for (r = -tolerance; r <= tolerance; r++)
    {
    printf("\n");
    for (c = -tolerance; c <= tolerance; c++)
      {
      int xcoord = centerx + c;
      int ycoord = centery + r;
      if ((xcoord < 0) || (xcoord >= width) ||
	  (ycoord < 0) || (xcoord >= height))
	continue;
      if ((r == 0) && (c == 0))
	  {
	  if (pixval(xcoord,ycoord,width) == WHITE)
	      printf("X");
	  else
	      printf("O");
	  }
      else if (bShow && (r == cury) && (c == curx))
	  {
	  if (pixval(xcoord,ycoord,width) == WHITE)
	      printf("*");
	  else
	      printf("o");
	  }
      else
	  {
	  if (pixval(xcoord,ycoord,width) == WHITE)
	      printf("+");
	  else
	      printf(" ");
	  }
      }
    }
    printf("\nType Return to continue\n");
    fgets(buffer,sizeof(buffer),stdin);
    toTop();
}
/* Use character graphics to display the contents of a neighborhood
 * around a pixel location, and optionally the current to be examined
 * pixel.
 * @param image  BYTE array of data values to search
 * @param width  Width of the image
 * @param height Height of the image
 * @param centerx   Center pixel x
 * @param centery   Center pixel y
 * @param tolerance Radius of neighborhood
 * @param x  If >= 0, mark as current pixel
 * @param y  If >= 0, mark as current pixel
 */
Use character graphics to display the contents of a neighborhood
around a pixel location, and optionally the current to be examined
pixel.
Use character graphics to display the contents of a neighborhood around a pixel location and optionally the current to be examined pixel .
void showNeighborhood(BYTE* image,int width, int height,
		      int centerx, int centery, int tolerance, int x, int y)
{
  int r=0;  
  int c=0;  
  int curx;
  int cury; 
  int bShow = 0;
  char buffer[32];
  if ((x >= 0) && (y >= 0))
    {
    curx = x - centerx;
    cury = y - centery;
    bShow = 1;
    printf("x=%d, curx=%d, y=%d, cury=%d\n",x,curx,y,cury);
    }
  for (r = -tolerance; r <= tolerance; r++)
    {
    printf("\n");
    for (c = -tolerance; c <= tolerance; c++)
      {
      int xcoord = centerx + c;
      int ycoord = centery + r;
      if ((xcoord < 0) || (xcoord >= width) ||
	  (ycoord < 0) || (xcoord >= height))
	continue;
      if ((r == 0) && (c == 0))
	  {
	  if (pixval(xcoord,ycoord,width) == WHITE)
	      printf("X");
	  else
	      printf("O");
	  }
      else if (bShow && (r == cury) && (c == curx))
	  {
	  if (pixval(xcoord,ycoord,width) == WHITE)
	      printf("*");
	  else
	      printf("o");
	  }
      else
	  {
	  if (pixval(xcoord,ycoord,width) == WHITE)
	      printf("+");
	  else
	      printf(" ");
	  }
      }
    }
    printf("\nType Return to continue\n");
    fgets(buffer,sizeof(buffer),stdin);
    toTop();
}
void showNeighborhood ( BYTE * image , int width , int height , int centerx , int centery , int tolerance , int x , int y ) { int r = 0 ; int c = 0 ; int curx ; int cury ; int bShow = 0 ; char buffer [ 32 ] ; if ( ( x >= 0 ) && ( y >= 0 ) ) { curx = x - centerx ; cury = y - centery ; bShow = 1 ; printf ( " \n " , x , curx , y , cury ) ; } for ( r = - tolerance ; r <= tolerance ; r ++ ) { printf ( " \n " ) ; for ( c = - tolerance ; c <= tolerance ; c ++ ) { int xcoord = centerx + c ; int ycoord = centery + r ; if ( ( xcoord < 0 ) || ( xcoord >= width ) || ( ycoord < 0 ) || ( xcoord >= height ) ) continue ; if ( ( r == 0 ) && ( c == 0 ) ) { if ( pixval ( xcoord , ycoord , width ) == WHITE ) printf ( " " ) ; else printf ( " " ) ; } else if ( bShow && ( r == cury ) && ( c == curx ) ) { if ( pixval ( xcoord , ycoord , width ) == WHITE ) printf ( " " ) ; else printf ( " " ) ; } else { if ( pixval ( xcoord , ycoord , width ) == WHITE ) printf ( " " ) ; else printf ( " " ) ; } } } printf ( " \n \n " ) ; fgets ( buffer , sizeof ( buffer ) , stdin ) ; toTop ( ) ; }
Use character graphics to display the contents of a neighborhood
 around a pixel location, and optionally the current to be examined
 pixel.
Use character graphics to display the contents of a neighborhood around a pixel location and optionally the current to be examined pixel .
/* row counter */ /* column counter */