
// Example program
#include <iostream>
#include <string>


#define LOWEST_NUMBER 0
#define HIGHEST_NUMBER 255

#define ROWS 10
#define COLS 10

using namespace std;

void print_image(unsigned char image[][COLS], int nRows) 
{
 
}

int main()
{

  srand(17);
  unsigned char ImageInput[ROWS][COLS]; 
  
  unsigned char ImageOutput[ROWS][COLS]; 
  
  char Filter[3][3] = { {0,-1,0}, 
                                {-1,5,-1}, 
                                {0,-1,0}};
    
  int row, col;
  
  
  // Zero-out image input
  for (row = 0; row < ROWS; row = row + 1) 
  {
     for (col = 0; col < COLS; col = col + 1) {
         ImageInput[row][col]  = 0;
     }
  }
  
  // Fill in random numbers to center of the image
  for (row = 1; row < ROWS-1; row = row + 1) 
  {
     for (col = 1; col < COLS-1; col = col + 1) {
         ImageInput[row][col]  = (unsigned char) rand() % (HIGHEST_NUMBER - LOWEST_NUMBER + 1) + LOWEST_NUMBER;
     }
  }

  cout << "Original :" << "\n";
  print_image(ImageInput,ROWS);


  for (row = 0; row < ROWS; row = row + 1) 
  {
     for (col = 0; col < COLS; col = col + 1) {
         ImageOutput[row][col]  = 0;
     }
  }

  
  cout << "Filtered :" << "\n";
  for (row = 1; row < ROWS-1; row = row + 1) 
  {
     for (col = 1; col < COLS-1; col = col + 1) {
          ImageOutput[row][col] = 
                  + ImageInput[row-1][col-1] * Filter[0][0]
                  + ImageInput[row-1][col] * Filter[0][1]
                  + ImageInput[row-1][col+1] * Filter[0][2]
                  
                  + ImageInput[row][col-1] * Filter[1][0]
                  + ImageInput[row][col] * Filter[1][1]
                  + ImageInput[row][col+1] * Filter[1][2]
                  
                  + ImageInput[row+1][col-1] * Filter[2][0]
                  + ImageInput[row+1][col] * Filter[2][1]
                  + ImageInput[row+1][col+1] * Filter[2][2];
                  
     }
  }


  print_image(ImageOutput,ROWS);



}




