get-obj.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #include "Component/ModelManager.H"
00040 #include "Image/Image.H"
00041 #include "Image/Pixels.H"
00042 #include "Image/ColorOps.H"
00043 #include "Image/ShapeOps.H"
00044 #include "Image/MathOps.H"
00045 #include "Image/CutPaste.H"
00046 #include "Image/Transforms.H"
00047 #include "Media/FrameSeries.H"
00048 #include "Raster/Raster.H"
00049 #include "Util/log.H"
00050 #include "Util/Timer.H"
00051 #include "Learn/SOFM.H"
00052 #include "GUI/XWinManaged.H"
00053 #include "CMapDemo/SaliencyCMapMT.H"
00054 #include "SIFT/ScaleSpace.H"
00055 #include "SIFT/VisualObject.H"
00056 #include "SIFT/Keypoint.H"
00057 #include "SIFT/VisualObjectDB.H"
00058 #include "Image/FourierEngine.H"
00059 #include "RCBot/Motion/MotionEnergy.H"
00060
00061 #include <signal.h>
00062
00063
00064 #include <sys/types.h>
00065 #include <sys/stat.h>
00066 #include <unistd.h>
00067
00068 #include <sys/types.h>
00069 #include <sys/stat.h>
00070 #include <unistd.h>
00071
00072
00073
00074
00075 int main(const int argc, const char **argv)
00076 {
00077
00078 MYLOGVERB = LOG_INFO;
00079 ModelManager manager("Test SIFT");
00080 XWinManaged xwin(Dims(704,480), -1, -1, "Get Object");
00081
00082 if (manager.parseCommandLine(
00083 (const int)argc, (const char**)argv, "<Image> <Mask>", 2, 2) == false);
00084
00085 char filename[255];
00086 for (int i=0; i<100; i++)
00087 {
00088
00089 sprintf(filename, "%s/RPGData%03d.ppm", manager.getExtraArg(0).c_str(), i);
00090 struct stat statBuf;
00091 if (!stat(filename, &statBuf))
00092 {
00093 Image<PixRGB<byte> > img = Raster::ReadRGB(filename);
00094
00095 sprintf(filename, "%s/RPGData%03dTarget.pgm", manager.getExtraArg(1).c_str(), i);
00096 Image<PixRGB<byte> > imgMask = Raster::ReadRGB(filename);
00097
00098
00099 Image<PixRGB<byte> >::iterator imgPtr = img.beginw();
00100 Image<PixRGB<byte> >::const_iterator imgMaskPtr = imgMask.beginw(),
00101 imgMaskStop = imgMask.end();
00102
00103 while (imgMaskPtr != imgMaskStop)
00104 {
00105 if (imgMaskPtr->p[0] == 0.0f){
00106 *imgPtr = PixRGB<byte>((byte)0, (byte)0, (byte)0);
00107 }
00108 imgMaskPtr++; imgPtr++;
00109 }
00110
00111
00112
00113 sprintf(filename, "%s/out%03dTarget.ppm", manager.getExtraArg(1).c_str(), i);
00114 Raster::WriteRGB(img, filename);
00115
00116 }
00117 }
00118
00119
00120
00121 return 0;
00122
00123 }