/* Template for a 3x3 network */ #include #include #include #include #include // put the snns2c code here // call the network function ann3x3() #define InputSize 7 int main(int argc, char *argv[]) { unsigned char *im, *outim; int rows, cols, colors; long i, j, k, a, b, c; float in[InputSize * InputSize]; float out; if(argc < 2) { printf("Usage: function \n"); exit(-1); } im = readPGM(&rows, &cols, &colors, argv[1]); if(im == NULL) { printf("Error: Unable to read %s\n", argv[1]); exit(-1); } outim = (unsigned char *)malloc(sizeof(unsigned char) * (long)rows * (long)cols); //initialize the output image for(i=0;i<(long)rows * (long)cols;i++) outim[i] = im[i]; for(i=InputSize/2;i 255.0 ? 255.0 : (out * 255.0); } } writePGM(outim, rows, cols, colors, "output.pgm"); return(0); }