]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
Do not use this program anymore, the mask processing pipeline has been shorten from:
authorPetr Kubiznak <kubizpet@fel.cvut.cz>
Wed, 19 May 2010 17:39:45 +0000 (19:39 +0200)
committerPetr Kubiznak <kubizpet@fel.cvut.cz>
Wed, 19 May 2010 17:39:45 +0000 (19:39 +0200)
 maskgen: mask???.png | clr2float_conv: mask???.bin | rozkuk
to:
 maskgen: mask???.pnm | rozkuk

src/camera/rozkuk/Makefile.omk
src/camera/rozkuk/clr2float_conv.cxx

index 0008cd7a58c69dd393612a33ca17629ee16777ab..754631478fd4b1c9b7055bd6fdff4c18fb7cc87b 100644 (file)
@@ -33,6 +33,6 @@ ymasks.stamp: $(SOURCES_DIR)/ymasks_mask.png
        $(OUTPUT_DIR)/_compiled/bin/maskgen $< -b 30 -y
        touch $@
 masks.stamp: bmasks.stamp ymasks.stamp
-       $(OUTPUT_DIR)/_compiled/bin/clr2float_conv mask*.png
+#      $(OUTPUT_DIR)/_compiled/bin/clr2float_conv mask*.png
        touch $@
 endif
index f09725cf94260487a00cbdb7ab5938d5fb3daa0b..31cfd1790048487562076d51da50366994c802a2 100644 (file)
@@ -6,6 +6,9 @@
  *
  * 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.
@@ -68,31 +71,32 @@ int processFile(const char *filename, unsigned char threshold) {
        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;
 }