*
* Petr Kubizňák (kubiznak.petr@gmail.com), 2010
*
+ * !!! @deprecated !!! - the program is useless since maskgen generates pnm files,
+ * which are then loaded directly by rozkuk
+ *
* Usage: ./clr2float_conv filenames... [-t value]
* filenames:
* Names of picture files to convert.
fprintf(stderr, "Error: File %s does not exist!\n", filename);
return 1;
}
- pOutput = fopen(destFilename, "w");
+/* pOutput = fopen(destFilename, "w");
if(!pOutput) {
fprintf(stderr, "Error: Cannot write to file %s!\n", destFilename);
fclose(pInput);
return 2;
- }
+ }*/
// load input image and generate a float <-1,1> format
clrImage = cvLoadImage(filename);
if(!clrImage) return 1;
if(!(outputLen=clr2float(clrImage, &outputMat, threshold, 1.0, NULL))) {
cvReleaseImage(&clrImage);
fclose(pInput);
- fclose(pOutput);
+// fclose(pOutput);
}
// write the data to the file
output = outputMat->data.fl;
- writtenLen = fwrite(output, sizeof(output[0]), outputLen, pOutput);
- if(writtenLen != outputLen)
- fprintf(stderr, "File \"%s\" processed, but an error occured when writting the output to \"%s\".\n", filename, destFilename);
- else
+// writtenLen = fwrite(output, sizeof(output[0]), outputLen, pOutput);
+ if(cvSaveImage(destFilename, outputMat))
+// if(writtenLen != outputLen)
fprintf(stderr, "File \"%s\" processed. Output successfully written to \"%s\".\n", filename, destFilename);
+ else
+ fprintf(stderr, "File \"%s\" processed, but an error occured when writting the output to \"%s\".\n", filename, destFilename);
cvReleaseImage(&clrImage);
fclose(pInput);
- fclose(pOutput);
+// fclose(pOutput);
return 0;
}