1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "otbStandardMetaImageFunctionBuilder.h"
#include "otbVectorImage.h"
#include "otbImageFileReader.h"
#include "otbImageFunctionAdaptor.h"
#include "otbFlusserMomentsImageFunction.h"
#include "otbRadiometricMomentsImageFunction.h"
#include "otbFourierMellinDescriptorsImageFunction.h"
#include "otbLocalHistogramImageFunction.h"
#include "otbHaralickTexturesImageFunction.h"
int otbStandardMetaImageFunctionBuilderNew(int itkNotUsed(argc), char* itkNotUsed(argv)[])
{
typedef double PrecisionType;
typedef otb::StandardMetaImageFunctionBuilder<PrecisionType> BuilderType;
// instantiation
BuilderType::Pointer builder = BuilderType::New();
std::cout << builder << std::endl;
return EXIT_SUCCESS;
}
int otbStandardMetaImageFunctionBuilder(int itkNotUsed(argc), char* argv[])
{
const char * inputFilename = argv[1];
std::vector<double> p1, p2, p3, p4, p5;
typedef double PrecisionType;
typedef double CoordRepType;
typedef otb::StandardMetaImageFunctionBuilder<PrecisionType,
CoordRepType> BuilderType;
typedef otb::Image<PrecisionType, 2> ImageType;
typedef otb::VectorImage<PrecisionType, 2> VectorImageType;
typedef otb::ImageFileReader<ImageType> ImageReaderType;
typedef otb::ImageFileReader<VectorImageType> VectorImageReaderType;
typedef BuilderType::MetaImageFunctionType MetaImageFunctionType;
typedef BuilderType::DataObjectContainerType DataObjectContainerType;
typedef otb::FlusserMomentsImageFunction<ImageType, CoordRepType> FlusserMomentsIF;
typedef otb::ImageFunctionAdaptor<FlusserMomentsIF, PrecisionType> AdaptedFlusserMomentsIF;
typedef otb::RadiometricMomentsImageFunction<ImageType, CoordRepType> RadiometricMomentsIF;
typedef otb::ImageFunctionAdaptor<RadiometricMomentsIF, PrecisionType> AdaptedRadiometricMomentsIF;
typedef otb::FourierMellinDescriptorsImageFunction<ImageType, CoordRepType> FourierMellinDescriptorsIF;
typedef otb::ImageFunctionAdaptor<FourierMellinDescriptorsIF, PrecisionType> AdaptedFourierMellinDescriptorsIF;
p1.push_back(7);
p1.push_back(128);
p1.push_back(0);
p1.push_back(1500);
p2.push_back(6);
p3.push_back(5);
p4.push_back(9);
p4.push_back(5);
p4.push_back(5);
p5.push_back(10);
p5.push_back(1);
p5.push_back(1500);
p5.push_back(16);
p5.push_back(4);
// instantiation
ImageReaderType::Pointer Ireader = ImageReaderType::New();
VectorImageReaderType::Pointer VIreader = VectorImageReaderType::New();
BuilderType::Pointer builder = BuilderType::New();
Ireader->SetFileName(inputFilename);
VIreader->SetFileName(inputFilename);
builder->AddImage(Ireader->GetOutput());
builder->SetNeighborhoodRadius(8);
builder->SetLocalHistogramIFParameters(p1);
builder->SetFlusserMomentsIFParameters(p2);
builder->SetRadiometricMomentsIFParameters(p3);
builder->SetFourierMellinDescriptorsIFParameters(p4);
builder->SetHaralickTexturesIFParameters(p5);
builder->AddImage(VIreader->GetOutput());
MetaImageFunctionType::Pointer MIF = builder->GetMetaImageFunction();
std::cout << MIF << std::endl;
DataObjectContainerType DOC = builder->GetDataObjectContainer();
std::cout << "DataObjectContainer.size(): " << DOC.size() << std::endl;
std::cout << static_cast<AdaptedRadiometricMomentsIF *>(MIF->GetNthFunction(0))->GetInternalImageFunction()
<< std::endl;
std::cout << static_cast<AdaptedRadiometricMomentsIF *>(MIF->GetNthFunction(3))->GetInternalImageFunction()
<< std::endl;
std::cout << static_cast<AdaptedFlusserMomentsIF *>(MIF->GetNthFunction(1))->GetInternalImageFunction()
<< std::endl;
std::cout << static_cast<AdaptedFlusserMomentsIF *>(MIF->GetNthFunction(7))->GetInternalImageFunction()
<< std::endl;
std::cout << static_cast<AdaptedFourierMellinDescriptorsIF *>(MIF->GetNthFunction(2))->GetInternalImageFunction()
<< std::endl;
std::cout << static_cast<AdaptedFourierMellinDescriptorsIF *>(MIF->GetNthFunction(11))->GetInternalImageFunction()
<< std::endl;
/*
std::cout << static_cast<AdaptedLocalHistogramIF *>(MIF->GetNthFunction())->GetInternalImageFunction()
<< std::endl;
std::cout << static_cast<AdaptedLocalHistogramIF *>(MIF->GetNthFunction(5))->GetInternalImageFunction()
<< std::endl;
std::cout << static_cast<AdaptedHaralickTexturesIF *>(MIF->GetNthFunction(4))->GetInternalImageFunction()
<< std::endl;
std::cout << static_cast<AdaptedHaralickTexturesIF *>(MIF->GetNthFunction(21))->GetInternalImageFunction()
<< std::endl;
*/
return EXIT_SUCCESS;
}
|