Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pngo.scale_wh(50, 20);
- fcode data;
- data.out[0] = tolower(file[12]);
- data.out[1] = tolower(file[13]);
- data.out[2] = tolower(file[14]);
- char newbin[50];
- sprintf( newbin, "%ccbox.dat", (ang>0? 'u' : 'l'), out);
- FILE * fp = fopen( newbin, "a" );
- if(fp == NULL) {
- perror("failed to open box.dat");
- return 0;
- }
- double halfwhite = white/2;
- for(int y = 0; y < pngo.getheight(); y++)
- for(int x = 0; x < pngo.getwidth(); x++ ) {
- data.in[y][x] = (double)(pngo.read(x+1,y+1) - halfwhite)/ (halfwhite+1);
- fprintf( fp, "%0.1f ", data.in[y][x] );
- }
- fprintf( fp, "\n" );
- char s[18] = { '1','2','3','4','5','7','9','a','b','c','h','j','k','m','r','w','x','y' };
- for(int j = 0; j < 3; j++ )
- for(int i = 0; i < 18; i++ )
- if( s[i] == data.out[j] )
- fprintf(fp, "%0.1f ", 1.0 );
- else
- fprintf(fp, "%0.1f ", -1.0 );
- fprintf( fp, "\n" );
- if( fclose(fp) )
- printf("fclose(fp) failed.\n" );
- cout << "Done with " << (char)tolower(file[12]) << (char)tolower(file[13]) << (char)tolower(file[14]) << endl;
- pngo.close();
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement