/* Change Detection Defference Statistics v1.0.0 Ver.:OK (c) 12/07 - Christos Iosifides */
/*
Name: CD_DiffStat_8ui
Version: 1.0.0
Author: Christos Iosifidis
Date: 03/12/07 11:30
Description: Change Detection Differennce and Statistics on 8bit unsigned int BIL datasets
Usage: >CD_DiffStat_8ui 1st 2nd_filename_of_the_8bit_unsigned_int_BIL_dataset Signed16bitInt_BIL_dataset rows columns bands Statistics_Report_file
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#include
#include
#include
void error(const char *);
int main(int argc, char *argv[]) {
FILE *fpin1, *fpin2, *fpout;
int rows, cols, bands, X1, X2, *stat_a1, s;
unsigned char *in_buffer1, *in_buffer2;
signed short int *out_buffer;
register int r, c, i, j, k;
if (argc!=7)
error("Usage parameters: 1st 2nd_filename_of_the_8bit_unsigned_int_BIL_dataset Signed16bitInt_BIL_dataset rows columns bands");
rows=atoi(argv[4]);
cols=atoi(argv[5]);
bands=atoi(argv[6]);
if (rows<3)
error("rows must be larger than 3");
if (cols<3)
error("columns must be larger than 3");
if (bands<1)
error("bands must be more than 1");
/* Allocate statistics array */
if ((stat_a1=(int *)malloc(sizeof(int)*256*256*bands))==NULL)
error("Not enough memory avaliable for statistics array");
/* Initialize statistics array - calloc can be used instead */
for (i=0;i<256;i++)
for (j=0;j<256;j++)
for (k=0;k.\n",s);
exit(1);
}