imageprocessing/debugFunctions.c
void printNeighborhood(BYTE* image,int width, int height,
			int x, int y, int tolerance)
{
    int r = 0;  /* row counter */
    int c = 0;  /* column counter */
    int cardinalX[] = {1,0,-1,0};  /* E,S,W,N */
    int cardinalY[] = {0,1,0,-1};
    int diagX[] = {1,-1,-1,1};  /* SE,SW,NW,NE */
    int diagY[] = {1,1,-1,-1};
    int radius = 1;  /* start at 1, gradually increase */
    char message[256];
    printf("Center %d,%d\n", x,y);
    for (r = y - tolerance; r <= y + tolerance ; r++)
      {
      for (c = x - tolerance; c <= x + tolerance; c++)
	{
	printf("%d ",(pixval(c,r,width) == WHITE)? 1 : 0);
        }
      printf("\n");
      }
    printf("\n");
}
/* Print the image data in a neighborhood centered 
 * on x,y. Prints a '1' for white and a '0 for black.
 * @param image  BYTE array of data values to search
 * @param width  Width of the image
 * @param height Height of the image
 * @param x      Center pixel x
 * @param y      Center pixel y
 * @param tolerance Radius of region to search for the starting point 
 */
Print the image data in a neighborhood centered
on x,y. Prints a '1' for white and a '0 for black.
Print the image data in a neighborhood centered on x y . Prints a ' 1 ' for white and a ' 0 for black .
void printNeighborhood(BYTE* image,int width, int height,
			int x, int y, int tolerance)
{
    int r = 0;  
    int c = 0;  
    int cardinalX[] = {1,0,-1,0};  
    int cardinalY[] = {0,1,0,-1};
    int diagX[] = {1,-1,-1,1};  
    int diagY[] = {1,1,-1,-1};
    int radius = 1;  
    char message[256];
    printf("Center %d,%d\n", x,y);
    for (r = y - tolerance; r <= y + tolerance ; r++)
      {
      for (c = x - tolerance; c <= x + tolerance; c++)
	{
	printf("%d ",(pixval(c,r,width) == WHITE)? 1 : 0);
        }
      printf("\n");
      }
    printf("\n");
}
void printNeighborhood ( BYTE * image , int width , int height , int x , int y , int tolerance ) { int r = 0 ; int c = 0 ; int cardinalX [ ] = { 1 , 0 , -1 , 0 } ; int cardinalY [ ] = { 0 , 1 , 0 , -1 } ; int diagX [ ] = { 1 , -1 , -1 , 1 } ; int diagY [ ] = { 1 , 1 , -1 , -1 } ; int radius = 1 ; char message [ 256 ] ; printf ( " \n " , x , y ) ; for ( r = y - tolerance ; r <= y + tolerance ; r ++ ) { for ( c = x - tolerance ; c <= x + tolerance ; c ++ ) { printf ( " " , ( pixval ( c , r , width ) == WHITE ) ? 1 : 0 ) ; } printf ( " \n " ) ; } printf ( " \n " ) ; }
Print the image data in a neighborhood centered
 on x,y.
Print the image data in a neighborhood centered on x y .
/* row counter */ /* column counter */ /* E,S,W,N */ /* SE,SW,NW,NE */ /* start at 1, gradually increase */