00001 #include "Core/Geometry/PointZList.h"
00002 #include "Core/Stream/RgbDataSrcFactory.h"
00003 #include "Core/Stream/RgbDataSrcWindow.h"
00004 #include "Core/Stream/SeqConvKernel.h"
00005 #include "Core/Array/ColorSegmentation.h"
00006 #include "Core/Array/Percentile.h"
00007 #include "Core/Array/GreaterThanVal.h"
00008 #include "Core/Array/Abs.h"
00009 #include "Core/Array/WritePgm.h"
00010 #include "Core/Array/WritePng.h"
00011 #include "Core/Array/WriteJpg.h"
00012 #include "Core/Array/Rotate.h"
00013 #include "Core/Array/MakeFromData.h"
00014 #include "Core/Array/RGB2Intensity.h"
00015 #include "Core/Array/GetRgbPixels.h"
00016 #include "Core/Array/Set.h"
00017 #include "Core/Array/WriteRaw.h"
00018 #include "Core/Array/ReadRaw.h"
00019 #include "Core/Array/Erosion.h"
00020 #include "Core/Array/Dilation.h"
00021 #include "Core/Array/Threshold.h"
00022 #include "Core/Array/Label.h"
00023 #include "Core/Array/Watershed.h"
00024 #include "Core/Array/GeodesicDistanceTransform.h"
00025 #include "Core/Array/SKIZ.h"
00026 #include "Core/Array/ProjectRange.h"
00027 #include "Core/Array/GaussDerivative.h"
00028 #include "Core/Array/RecGauss.h"
00029 #include "Core/Array/Trait/BpoEqual.h"
00030 #include "Core/Array/Harris.h"
00031 #include "Core/Array/InvCompDer.h"
00032 #include "Core/Array/KeypointsLowe.h"
00033
00034 #include "Visualization/Window.h"
00035 #include "Visualization/AppControlSrc.h"
00036 #include "Visualization/ViewListenerWithCircles.h"
00037 #include "Visualization/ViewListenerWithArrows.h"
00038
00039
00040 #include "OglGui/OglLib.cpp"
00041 #include "Link/ImpalaLib.cpp"
00042
00043 namespace Impala
00044 {
00045 namespace Application
00046 {
00047 namespace Src
00048 {
00049
00050
00051 using namespace Impala::Visualization;
00052 using namespace Impala::Core::Array;
00053 using namespace Impala::Core::Stream;
00054 using namespace Impala::Core::Geometry;
00055
00056
00057 String gCmd;
00058 int gVerbose = 0;
00059 Real64 gSigma = 1.0;
00060 Real64 gPrecision = 3.0;
00061 Real64 gLogScale = 32.0;
00062 String gDispMode("LogMagnitude");
00063 Real64 gSigmaA = 3.0;
00064 Real64 gK = 0.00;
00065 bool gUseRecGauss = false;
00066 int gBorderSize = 19;
00067
00068 class BpoSwiss
00069 {
00070 public:
00072 typedef Pattern::TagTransInVar TransVarianceCategory;
00073
00075 typedef Pattern::TagCallValue CallCategory;
00076
00077 BpoSwiss(Real64 theMax, int dimension)
00078 {
00079 mTheMax = theMax;
00080 mDimension = dimension;
00081 }
00082
00083 Element::Vec3Real64
00084 DoIt(const Element::Vec3Real64& v, const Real64& s)
00085 {
00086 Real64 f = (s > 0) ? (s / mTheMax) * 255 : 0;
00087 if (f < 32)
00088 return v;
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 if (mDimension == 1)
00099 return Element::Vec3Real64(255, v.Y(), v.Z());
00100 else if (mDimension == 2)
00101 return Element::Vec3Real64(v.X(), 255, v.Z());
00102 return Element::Vec3Real64(v.X(), v.Y(), 255);
00103
00104
00105
00106
00107
00108
00109
00110
00111 }
00112
00113 private:
00114 Real64 mTheMax;
00115 int mDimension;
00116 };
00117
00118 class ExportPoints
00119 {
00120 public:
00121 typedef Pattern::TagPixOpOut DirectionCategory;
00122 typedef Pattern::TagTransVar TransVarianceCategory;
00123 typedef Pattern::Tag1Phase PhaseCategory;
00124
00125 ExportPoints(Real64 theMax, PointZListBI pListBI) :
00126 mPListBI(pListBI), mTheMax(theMax)
00127 {
00128 }
00129
00130 void
00131 DoIt(const Real64& s, int x, int y)
00132 {
00133 Real64 f = (s > 0) ? (s / mTheMax) * 255 : 0;
00134 if (f < 32)
00135 return;
00136 *mPListBI++ = PointZ(x, y);
00137 }
00138
00139 private:
00140
00141 Real64 mTheMax;
00142 PointZListBI mPListBI;
00143 };
00144
00145
00146 void
00147 DoMaxPoints(Array2dVec3Real64* dst, Array2dScalarReal64* src, int dimension,
00148 PointZListBI pListBI)
00149 {
00150 int cw = 2*gSigmaA + 1;
00151 int ch = 2*gSigmaA + 1;
00152 Array2dScalarReal64* ker = ArrayCreate<Array2dScalarReal64>(cw, ch);
00153 Core::Matrix::MatSet(ker, 0);
00154
00155 Array2dScalarReal64* tmp1 = 0;
00156 Dilation(tmp1, src, ker);
00157 Trait::BpoEqual<Array2dScalarReal64, Array2dScalarReal64,
00158 Array2dScalarReal64> bpo(0.0000000000000001);
00159 Pattern::PatBinaryPixOp(tmp1, tmp1, src, bpo);
00160 Mul(tmp1, tmp1, src);
00161 Real64 theMax = PixMax(tmp1);
00162
00163
00164 ExportPoints expPoints(theMax, pListBI);
00165 Pattern::PatInOutOp(tmp1, expPoints);
00166
00167 Array2dScalarReal64* tmp2 = 0;
00168 Dilation(tmp2, tmp1, ker);
00169 delete ker;
00170
00171 BpoSwiss bpoSwiss(theMax, dimension);
00172 Pattern::PatBinaryPixOp(dst, dst, tmp2, bpoSwiss);
00173 delete tmp1;
00174 delete tmp2;
00175 }
00176
00177
00178
00179 class WindowSrc : public Window, public AppControlSrc
00180 {
00181 public:
00182
00183 WindowSrc(RgbDataSrc* src) :
00184 Window(0, 0, SuggestWndWidth(3, src->FrameWidth()),
00185 SuggestWndHeight(2, src->FrameHeight()) + 25, true),
00186 AppControlSrc(1)
00187 {
00188 CmdOptions& options = CmdOptions::GetInstance();
00189 SetSrc(src);
00190 AppController::Instance().AddControl((AppControlSrc*) this, true);
00191 mViewScale = options.GetDouble("viewScale");
00192 mCircleView1 = 0;
00193 mCircleView2 = 0;
00194 mCircleView4 = 0;
00195 mCircleView5 = 0;
00196 mArrowView = 0;
00197 if (gCmd == "tgauss")
00198 {
00199 mTGauss = MakeGaussian1d(gSigma, 1, gPrecision, 100);
00200
00201
00202 WindowPrepGaussDerivative* tmp = new WindowPrepGaussDerivative
00203 (3.0, 1, 0, 3.0);
00204 mSrcWindow = new RgbDataSrcWindow<WindowPrepGaussDerivative>
00205 (GetSrc(), mTGauss->CW(), tmp);
00206 }
00207
00208 #ifdef OGL_USING_GLUT
00209
00210 #endif
00211 AppController::Instance().MainLoop();
00212 }
00213
00214
00215
00216 void
00217 HandleCycleSrc()
00218 {
00219
00220 SetStatusStr((char*) GetFpsString().c_str());
00221 }
00222
00223 void
00224 HandleNewFrame()
00225 {
00226 UpdateView(0, GetSrc()->DataPtr(), GetSrc()->FrameWidth(),
00227 GetSrc()->FrameHeight(), mViewScale);
00228
00229 Util::Database* db = &Util::Database::GetInstance();
00230 ArraySystem& aSys = ArraySystem::Instance();
00231 aSys.MarkMemoryUsage(gVerbose > 0);
00232
00233 Array2dVec3UInt8* srcWrap = ArrayCreate<Array2dVec3UInt8>
00234 (GetSrc()->FrameWidth(), GetSrc()->FrameHeight(), 0, 0,
00235 GetSrc()->DataPtr(), true);
00236 Array2dVec3Real64* srcV3R64 = ArrayCreate<Array2dVec3Real64>
00237 (GetSrc()->FrameWidth(), GetSrc()->FrameHeight(), gBorderSize,
00238 gBorderSize);
00239 MakeFromData2<Array2dVec3Real64,Array2dVec3UInt8>(srcV3R64,
00240 GetSrc()->DataPtr());
00241 Array2dScalarReal64* srcSR64 = 0;
00242 RGB2Intensity(srcSR64, srcV3R64);
00243
00244
00245 if (gCmd == "keypoints")
00246 {
00247 if (gVerbose > 0)
00248 std::cout << "doing keypoints" << std::endl;
00249 mAList.clear();
00250 Array2dScalarReal64* points = 0;
00251 Array2dScalarUInt8* featVecs = 0;
00252 KeypointsLowe(points, featVecs, srcWrap, false);
00253 for (int r=0 ; r<points->CH() ; r++)
00254 {
00255 Real64* pointPtr = points->CPB(0, r);
00256 ArrowR a;
00257 a.mPX = *pointPtr++;
00258 a.mPY = *pointPtr++;
00259
00260 a.mLen = *pointPtr++;
00261 a.mDir = *pointPtr++;
00262 mAList.push_back(a);
00263 }
00264 delete points;
00265 delete featVecs;
00266 if (mArrowView == 0)
00267 mArrowView = new ViewListenerWithArrows(&mAList, oglRED);
00268 UpdateView(1, srcSR64, "Stretch", mViewScale, mArrowView);
00269 }
00270
00271 if (gCmd == "tgauss")
00272 {
00273 if (gVerbose > 0)
00274 std::cout << "doing tgauss" << std::endl;
00275 mSrcWindow->FollowSrc();
00276 Array2dVec3Real64* res = 0;
00277 SeqConvKernel(res, mSrcWindow, mTGauss);
00278 int v = 1;
00279 UpdateView(v++, res, "Stretch", mViewScale);
00280 for (int d=1 ; d<=3 ; d++)
00281 {
00282 Array2dScalarReal64* p = 0;
00283 ProjectRange(p, res, d);
00284 UpdateView(v++, p, "Stretch", mViewScale);
00285 delete p;
00286 }
00287 delete res;
00288 for (int i=0 ; i<mSrcWindow->WindowSize() ; i++)
00289 UpdateView(v++, mSrcWindow->DataArrayWindow(i), "Direct",
00290 mViewScale);
00291 }
00292
00293 if (gCmd == "segment")
00294 {
00295 if (gVerbose > 0)
00296 std::cout << "doing segment" << std::endl;
00297 ColorSegmentationAlgorithm segAlg = TextureAddZero;
00298 ColorSegmentationInvariant invariantType = C;
00299
00300
00301
00302 double minRegionFraction = 0.01;
00303
00304 double threshold = 6.0;
00305 bool gUseGauss = false;
00306 std::cout << "segAlg = " << MakeString(segAlg) << ", invariantType = "
00307 << MakeString(invariantType) << std::endl;
00308 std::cout << "minRegionFraction = " << minRegionFraction
00309 << ", threshold = " << threshold << std::endl;
00310 Array2dVec3UInt8* dst = 0;
00311 std::vector<Array2dVec3UInt8*> dispList;
00312 ColorSegmentation(dst, srcV3R64, segAlg, invariantType,
00313 minRegionFraction, threshold, gUseGauss,
00314 &dispList);
00315 UpdateView(1, dst, "Direct", mViewScale);
00316 for (int i=0 ; i<dispList.size() ; i++)
00317 UpdateView(2+i, dispList[i], "Direct", mViewScale);
00318 delete dst;
00319 ArrayListDelete(&dispList);
00320 }
00321
00322 if (gCmd == "inv")
00323 {
00324 if (gVerbose > 0)
00325 std::cout << "doing inv" << std::endl;
00326 Array2dVec3Real64* srcCopy = 0;
00327 Set(srcCopy, srcV3R64);
00328
00329 std::vector<Array2dScalarReal64*> rgbList;
00330 rgbList = InvCompDer(srcV3R64, gSigma, gPrecision, gUseRecGauss);
00331 Array2dScalarReal64* im = 0;
00332
00333 HarrisObj<Array2dScalarReal64>(im, rgbList, gSigmaA, gK,
00334 gUseRecGauss);
00335 mPList1.clear();
00336 DoMaxPoints(srcV3R64, im, 1, std::back_inserter(mPList1));
00337 if (mCircleView1 == 0)
00338 mCircleView1 = new ViewListenerWithCircles(&mPList1, 5,
00339 oglRED);
00340 UpdateView(1, im, gDispMode, mViewScale, mCircleView1);
00341
00342 HarrisSperical<Array2dScalarReal64>(im, rgbList, gSigmaA, gK,
00343 gUseRecGauss);
00344 mPList2.clear();
00345 DoMaxPoints(srcV3R64, im, 2, std::back_inserter(mPList2));
00346 if (mCircleView2 == 0)
00347 mCircleView2 = new ViewListenerWithCircles(&mPList2, 5,
00348 oglGREEN);
00349 UpdateView(2, im, gDispMode, mViewScale, mCircleView2);
00350
00351 UpdateView(0, srcV3R64, "Direct", mViewScale);
00352 UpdateView(3, srcCopy, "Direct", mViewScale);
00353
00354 HarrisRGB<Array2dScalarReal64>(im, rgbList, gSigmaA, gK,
00355 gUseRecGauss);
00356 mPList4.clear();
00357 DoMaxPoints(srcCopy, im, 2, std::back_inserter(mPList4));
00358 if (mCircleView4 == 0)
00359 mCircleView4 = new ViewListenerWithCircles(&mPList4, 5,
00360 oglGREEN);
00361 UpdateView(4, im, gDispMode, mViewScale, mCircleView4);
00362
00363 HarrisOpponent<Array2dScalarReal64>(im, rgbList, gSigmaA, gK,
00364 gUseRecGauss);
00365 mPList5.clear();
00366 DoMaxPoints(srcCopy, im, 1, std::back_inserter(mPList5));
00367 if (mCircleView5 == 0)
00368 mCircleView5 = new ViewListenerWithCircles(&mPList5, 5,
00369 oglRED);
00370 UpdateView(5, im, gDispMode, mViewScale, mCircleView5);
00371
00372 UpdateView(3, srcCopy, "Direct", mViewScale);
00373
00374 delete srcCopy;
00375 delete im;
00376 ArrayListDelete(&rgbList);
00377 }
00378
00379 if (gCmd == "write")
00380 {
00381 if (gVerbose > 0)
00382 std::cout << "doing write" << std::endl;
00383 bool binary = true;
00384 WriteRaw(srcV3R64, "v3r64.raw", db, binary);
00385 WriteRaw(srcSR64, "sr64.raw", db, binary);
00386 UpdateView(1, srcSR64, "Stretch", mViewScale);
00387 }
00388
00389 if (gCmd == "erosion")
00390 {
00391 if (gVerbose > 0)
00392 std::cout << "doing erosion" << std::endl;
00393 int cw = 5;
00394 int ch = 9;
00395 Array2dScalarReal64* ker = ArrayCreate<Array2dScalarReal64>(cw, ch);
00396 Core::Matrix::MatSet(ker, 0);
00397 Array2dScalarReal64* res = 0;
00398 Erosion(res, srcSR64, ker);
00399
00400 UpdateView(1, res, "Stretch", mViewScale);
00401 delete ker;
00402 delete res;
00403 }
00404
00405 if (gCmd == "dilation")
00406 {
00407 if (gVerbose > 0)
00408 std::cout << "doing dilation" << std::endl;
00409 int cw = 5;
00410 int ch = 9;
00411 Array2dScalarReal64* ker = ArrayCreate<Array2dScalarReal64>(cw, ch);
00412 Core::Matrix::MatSet(ker, 0);
00413 Array2dScalarReal64* res = 0;
00414 Dilation(res, srcSR64, ker);
00415 UpdateView(1, res, "Stretch", mViewScale);
00416 delete ker;
00417 delete res;
00418 }
00419
00420 if (gCmd == "threshold")
00421 {
00422 if (gVerbose > 0)
00423 std::cout << "doing threshold" << std::endl;
00424 Array2dScalarUInt8* binIm = 0;
00425 Threshold(binIm, srcSR64, 128);
00426 UpdateView(1, binIm, "Binary", mViewScale);
00427 delete binIm;
00428 }
00429
00430 if (gCmd == "label")
00431 {
00432 if (gVerbose > 0)
00433 std::cout << "doing label" << std::endl;
00434 Array2dScalarUInt8* binIm = 0;
00435 Threshold(binIm, srcSR64, 128);
00436 UpdateView(1, binIm, "Binary", mViewScale);
00437 Array2dScalarInt32* labIm = ArrayClone<Array2dScalarInt32>(binIm);
00438 Timer tim(1);
00439 Label(labIm, binIm, 8);
00440 std::cout << "time: " << tim.SplitTime() << std::endl;
00441 UpdateView(2, labIm, "Label", mViewScale);
00442 delete binIm;
00443 delete labIm;
00444 }
00445
00446 if (gCmd == "watershed")
00447 {
00448 if (gVerbose > 0)
00449 std::cout << "doing watershed" << std::endl;
00450 Array2dScalarInt32* srcIm = 0;
00451 Set(srcIm, srcSR64);
00452 Array2dScalarInt32* dstIm = 0;
00453 Watershed(dstIm, srcIm, 8);
00454 UpdateView(1, dstIm, "Stretch", mViewScale);
00455 delete srcIm;
00456 delete dstIm;
00457 }
00458
00459 if (gCmd == "geodesic")
00460 {
00461 if (gVerbose > 0)
00462 std::cout << "doing geodesic" << std::endl;
00463 Array2dScalarInt32* srcIm = 0;
00464 Set(srcIm, srcSR64);
00465 Array2dScalarInt32* dstIm = 0;
00466 GeodesicDistanceTransform(dstIm, srcIm, 8);
00467 UpdateView(1, dstIm, "Stretch", mViewScale);
00468 delete srcIm;
00469 delete dstIm;
00470 }
00471
00472 if (gCmd == "skiz")
00473 {
00474 if (gVerbose > 0)
00475 std::cout << "doing skiz" << std::endl;
00476 Array2dScalarInt32* srcIm = 0;
00477 Set(srcIm, srcSR64);
00478 Array2dScalarInt32* dstIm = 0;
00479 SKIZ(dstIm, srcIm, 8);
00480 UpdateView(1, dstIm, "Stretch", mViewScale);
00481 delete srcIm;
00482 delete dstIm;
00483 }
00484
00485 if (gCmd == "rotate")
00486 {
00487 if (gVerbose > 0)
00488 std::cout << "doing rotate" << std::endl;
00489 Array2dScalarReal64* res = 0;
00490 Rotate(res, srcSR64, 45.0, NEAREST, false, 0);
00491 UpdateView(1, res, "Stretch", mViewScale);
00492 delete res;
00493 }
00494
00495 if (gCmd == "jpg")
00496 {
00497 if (gVerbose > 0)
00498 std::cout << "doing jpg" << std::endl;
00499 Array2dVec3UInt8* buf = ArrayCreate<Array2dVec3UInt8>
00500 (GetSrc()->FrameWidth(), GetSrc()->FrameHeight());
00501 GetRgbPixels(srcV3R64, buf->CPB(), "Direct");
00502 char fileName[50];
00503 sprintf(fileName, "frame_%06d.jpg", GetSrc()->FrameNr());
00504 WriteJpg(buf, String(fileName), db);
00505 delete buf;
00506 }
00507
00508 if (gCmd == "png")
00509 {
00510 if (gVerbose > 0)
00511 std::cout << "doing png" << std::endl;
00512 Array2dVec3UInt8* buf = ArrayCreate<Array2dVec3UInt8>
00513 (GetSrc()->FrameWidth(), GetSrc()->FrameHeight());
00514 GetRgbPixels(srcV3R64, buf->CPB(), "Direct");
00515 char fileName[50];
00516 sprintf(fileName, "frame_%06d.png", GetSrc()->FrameNr());
00517 WritePng(buf, String(fileName), db);
00518 delete buf;
00519 }
00520
00521 if (gCmd == "pgm")
00522 {
00523 if (gVerbose > 0)
00524 std::cout << "doing pgm" << std::endl;
00525 Array2dVec3UInt8* buf = ArrayCreate<Array2dVec3UInt8>
00526 (GetSrc()->FrameWidth(), GetSrc()->FrameHeight());
00527 GetRgbPixels(srcSR64, buf->CPB(), "Direct");
00528 char fileName[50];
00529 sprintf(fileName, "frame_%06d.pgm", GetSrc()->FrameNr());
00530 WritePgm(buf, String(fileName));
00531 delete buf;
00532 }
00533
00534 if (gCmd == "stretch")
00535 {
00536 if (gVerbose > 0)
00537 std::cout << "doing stretch" << std::endl;
00538 UpdateView(1, srcSR64, "Stretch", mViewScale);
00539 }
00540
00541 delete srcV3R64;
00542 delete srcSR64;
00543 delete srcWrap;
00544 aSys.CheckMemoryUsageSinceMark(gVerbose > 0);
00545 }
00546
00547 virtual void
00548 MouseFunc(INT msg, INT but, INT state, INT x, INT y)
00549 {
00550 Window::MouseFunc(msg, but, state, x, y);
00551
00552 if ((msg == oglMouseDown) && (but == oglRightButton))
00553 {
00554 OGLMENU menu = oglSys.MenuCreate();
00555 oglSys.MenuAdd(menu, "fps reset", 0, 2);
00556
00557 int choice = oglSys.MenuPopUp(mOglWnd, menu);
00558
00559 switch (choice)
00560 {
00561 case 2:
00562 FpsReset();
00563 break;
00564 }
00565
00566 oglSys.MenuDestroy(menu);
00567 oglSys.UpdateSceneFlag(mOglWnd, 1);
00568 }
00569 }
00570
00571 #ifdef APP_CONTROLLER_ALT
00572
00573 virtual void DisplayFunc()
00574 {
00575 SetAlwaysDraw(GetDoContinuous());
00576 AppControlSrc::ComputeCycle(0.04);
00577
00578
00579
00580 if (AppControlSrc::Done())
00581 exit(0);
00582 Window::DisplayFunc();
00583 }
00584 #endif
00585
00586 private:
00587
00588 double mViewScale;
00589
00590 PointZList mPList1;
00591 PointZList mPList2;
00592 PointZList mPList4;
00593 PointZList mPList5;
00594
00595 ViewListenerWithCircles* mCircleView1;
00596 ViewListenerWithCircles* mCircleView2;
00597 ViewListenerWithCircles* mCircleView4;
00598 ViewListenerWithCircles* mCircleView5;
00599 ArrowRList mAList;
00600 ViewListenerWithArrows* mArrowView;
00601
00602
00603
00604 RgbDataSrcWindow<WindowPrepGaussDerivative>* mSrcWindow;
00605 Array2dScalarReal64* mTGauss;
00606
00607 };
00608
00609 int
00610 mainSrc(int argc, char* argv[])
00611 {
00612 OglInit(&argc, &argv[0]);
00613 CmdOptions& options = CmdOptions::GetInstance();
00614 options.Initialise(true, true);
00615 String usageStr = "cmd camera|filename\n\n";
00616 usageStr += " cmd = stretch|pgm|png|jpg|rotate|skiz|geodesic|watershed|\n";
00617 usageStr += " label|threshold|dilation|erosion|write|inv|segment|\n";
00618 usageStr += " tgauss|keypoints\n";
00619 if (! options.ParseArgs(argc, argv, usageStr, 2))
00620 return 1;
00621
00622 gCmd = options.GetArg(0);
00623 String srcName = options.GetArg(1);
00624
00625 gVerbose = options.GetInt("verb");
00626 gSigma = options.GetDouble("sigma");
00627 gPrecision = options.GetDouble("precision");
00628 gUseRecGauss = options.GetBool("recGauss");
00629 gDispMode = options.GetString("disp");
00630 gLogScale = options.GetDouble("logScale");
00631
00632 Array2dScalarReal64* g = 0;
00633 if (gUseRecGauss)
00634 g = MakeGaussIIR1d(Max(gSigma,gSigmaA), 1, gPrecision);
00635 else
00636 g = MakeGaussian1d(Max(gSigma,gSigmaA), 1, gPrecision, 100);
00637 int gw = g->CW();
00638 if (gw > gBorderSize)
00639 {
00640 std::cout << "Adjusting bordersize to " << gw << std::endl;
00641 gBorderSize = gw;
00642 }
00643 delete g;
00644
00645 RgbDataSrcFactory& factory = RgbDataSrcFactory::Instance();
00646 RgbDataSrc* src = factory.Construct(srcName, options.GetString("src"));
00647 if (! src->Valid())
00648 {
00649 std::cout << "RgbDataSrc failed" << std::endl;
00650 return 0;
00651 }
00652 std::cout << src->LastFrame()+1 << " frames of " << src->FrameWidth()
00653 << " x " << src->FrameHeight() << std::endl;
00654
00655 WindowSrc* oglWnd = new WindowSrc(src);
00656 if (! oglWnd->Valid())
00657 {
00658 std::cout << "WindowSrc failed" << std::endl;
00659 return 0;
00660 }
00661
00662 return 1;
00663 }
00664
00665 }
00666 }
00667 }
00668
00669 int
00670 main(int argc, char* argv[])
00671 {
00672 return Impala::Application::Src::mainSrc(argc, argv);
00673 }