2D_LocalStats.C
Local Stats Region Segmentation of a 2D Image
00001 #include <Segmentation.h>
00002 #include <SegmentationModule/RegularizationModule.h>
00003 #include <SegmentationModule/LocalStatsRegionModule.h>
00004 #include <SegmentationModule/GaussianRegionModule.h>
00005
00008 int main(int argc, char* argv[])
00009 {
00010 using namespace Images;
00011 using namespace levelset;
00012 using namespace segmentation;
00013
00014 BaseImage<2, float> image;
00015 std::ifstream f("image/synthetic.inr");
00016 f >> format("inrimage") >> image;
00017
00018 FastMarchingInitializer<2,float> init;
00019 LevelSet<2,float> phi(image.shape(), (double) 2.0);
00020 Segmentation<2,float> segm(&phi, &init, &image);
00021
00022
00023
00024 phi.init_border(100);
00025
00026
00027
00028
00029
00030
00031 RegularizationModule<2,float> regul(1.f);
00032 LocalStatsRegionModule<2,float,float> local_stats( &image, 0.1f, 10);
00033
00034
00035 local_stats.use_local_variance() = false;
00036
00037
00038 segm.add_module(regul);
00039
00040 segm.add_module(local_stats);
00041
00042 segm.segment(1000, "localstats_");
00043
00044 std::cout << "OK" << std::endl;
00045
00046
00047 return 0;
00048 }