/*
             CREATOR: DAn williams
                DATE: dec 15 2000
         DESCRIPTION: find the luminessance peak in the image
            FILENAME: peaktest.c
             STARTED: see date
    OPERATING SYSTEM: Linux
1st VERSION FINISHED:



*/


#include <stdio.h>
#include <string.h>
//#include <conio.h>  // for dos
#include <stdlib.h>
#include "tga_read.h"
#include "findpeak.h"

//global variables


int main(int argc, char** argv)
{
  // local variables

  TgaStruct inputFile;
  int retcode;
  int n, R;
  
  retcode = 0;
  
  printf(" This program finds the brightness peak \n");
  printf(" Written by Dan Williams Dec 15 02000 \n");
  
  
  if (argc < 2) {                          // do we have input paramiters??   
      puts("Need the name of a targa file\n");
      return 0;    
  }
  
  if ((init_tga_read(argv[1], &inputFile)) == -1) {  //open text file 'param 1' w/ err chk 
    printf("Unable to open specified file for input");
    return 0;
  }
  
  
  printf("The image Width is %d \n", inputFile.Width);  
  printf("The image Height is %d \n", inputFile.Height);
  printf("The image bpp is %d \n", inputFile.bpp);

  for (n = 0; n < inputFile.Height; n++) {
    if ((R = scanline(&inputFile, n)) > (-1)) {
       printf("Y=%d, D=%d \n", n, R -(inputFile.Width / 2));
    }  
  }


  fin_tga_read(&inputFile); 


  return(retcode);
}


//subroutines




