#include "interface.h" int main (int argc, char** argv) { CSerial2 s; int iBaudRate; int b1; speed_t spBaud; unsigned int nBytes = 448*273; // result image size char cDefaultPath[] = "/dev/ttyUSB0"; char cDefaultBaud[] = "115200"; const char fName[] = "car_gray.B"; //450 x 275 const char fOutName[] = "car_sobel.raw"; if(argc < 3) { printf("Usage: serial_XUPV5 [RS232 port name] [Baud rate]" "\nExample: serial_XUPV5 /dev/ttyUSB0 115200" "\nThe program will search for a file named car_gray.B" "\nRunning with default settings...\n"); argv[1] = cDefaultPath; argv[2] = cDefaultBaud; } iBaudRate = atoi(argv[2]); spBaud = ConvertIntToBaud(iBaudRate); printf("Opening port using %s and %d bauds...\n", argv[1], iBaudRate); s.Open(argv[1], spBaud); FILE *fh1, *fh2; fh1 = fopen(fName, "rb"); if(!fh1) { printf("\nThe file \"%s\" does not exist!\n", fName); fflush(stdout); _exit(-1); } fseek( fh1, 0, SEEK_END); unsigned int oBytes = ftell(fh1); unsigned char *outBuffer = new unsigned char[oBytes]; unsigned char *inBuffer = new unsigned char[nBytes]; fseek( fh1, 0, SEEK_SET); for( unsigned int n=0; n