00001 /* 00002 * test-BOWN.C 00003 * 00004 * 00005 * Created by Randolph Voorhies on 11/25/07. 00006 * Copyright 2007 __MyCompanyName__. All rights reserved. 00007 * 00008 */ 00009 00010 #include "Component/ModelManager.H" 00011 #include "Media/FrameSeries.H" 00012 #include "Transport/FrameIstream.H" 00013 #include "Media/MediaOpts.H" 00014 #include "Image/Image.H" 00015 #include "Image/Pixels.H" 00016 #include "Raster/Raster.H" 00017 #include "GUI/XWinManaged.H" 00018 #include "Image/ImageSet.H" 00019 #include "Image/DrawOps.H" 00020 #include "Image/ShapeOps.H" 00021 #include "V2.H" 00022 #include "V1.H" 00023 #include <vector> 00024 #include <cstdio> 00025 00026 using namespace std; 00027 00028 int main(int argc, char* argv[]) { 00029 00030 ModelManager manager("Border Ownership"); 00031 00032 nub::soft_ref<InputFrameSeries> ifs(new InputFrameSeries(manager)); 00033 manager.addSubComponent(ifs); 00034 manager.exportOptions(MC_RECURSE); 00035 00036 //Parse command-line: 00037 if (manager.parseCommandLine(argc, argv,"[image {*.ppm}]", 0, 1) == false) return(1); 00038 00039 //Start the model manager 00040 manager.start(); 00041 00042 Image < float > jImage(Dims(50,50), ZEROS); //The input image 00043 00044 rutz::shared_ptr<XWinManaged> window1; 00045 window1.reset(new XWinManaged(Dims(ifs->getWidth()*2, ifs->getHeight()*2), 0, 0, "Border Ownership")); 00046 00047 V1 myV1(Dims(100,100)); 00048 V2 myV2(Dims(100,100)); 00049 00050 Image<byte> inputImage; 00051 Image<byte> edgeImage; 00052 Image<float> orientationImage; 00053 Image<float> magnitudeImage(ifs->peekDims(), ZEROS); //First Derivative Magnitude Image 00054 00055 inputImage.resize(ifs->peekDims()); 00056 edgeImage.resize(ifs->peekDims()); 00057 orientationImage.resize(ifs->peekDims()); 00058 00059 LINFO("Input Image = (%d,%d)", ifs->peekDims().w(), ifs->peekDims().h()); 00060 00061 while(1) { 00062 inputImage = ifs->readGray(); 00063 edgeImage.clear(); 00064 orientationImage.clear(); 00065 //myV1.cannyEdgeDetect(inputImage,edgeImage,orientationImage); 00066 00067 Image<float> fblurImage = luminance(convGauss(inputImage, sigma, sigma,10)); 00068 00069 //Find the magnitude and orientation 00070 gradient(fblurImage, magnitudeImage, orientationImage); 00071 00072 window1->drawImage(inputImage,0,0); 00073 window1->drawImage(orientationImage,edgeImage.getWidth(),0); 00074 /* window1->drawImage(scaledJImage,0,0); 00075 window1->drawImage(scaledWImage,scaledJImage.getWidth(), 0);*/ 00076 Raster::waitForKey(); 00077 00078 } 00079 00080 }