diff --git a/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.h b/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.h index 76404b2b055ba058b118c3e65094c9926a6a76a4..0f4eeaea005ac8b40aa5a717f4157a07ea313742 100644 --- a/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.h +++ b/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.h @@ -96,6 +96,10 @@ public: itkGetConstMacro(InhibitionRadius, double); itkSetMacro(InhibitionRadius, double); + /** The maximum iteration number during negative sample positions */ + itkGetConstMacro(NbMaxIteration, unsigned long int); + itkSetMacro(NbMaxIteration, unsigned long int); + /** Set the seed for random number generator */ void SetSeed(unsigned int seed) { @@ -122,6 +126,7 @@ private: int m_NoClassIdentifier; double m_RandomLocalizationDensity; double m_InhibitionRadius; + unsigned long int m_NbMaxIteration; }; } // end namespace otb diff --git a/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.txx b/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.txx index 8b31036d6fc8f4822475a857eada6db8091a9cd7..cfa68e0eeb8706699317ef5b397cfcf0a1d81e2e 100644 --- a/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.txx +++ b/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.txx @@ -29,8 +29,9 @@ LabeledSampleLocalizationGenerator<TVectorData> ::LabeledSampleLocalizationGenerator() : m_ClassKey("Class"), m_NoClassIdentifier(0), - m_RandomLocalizationDensity(.05), - m_InhibitionRadius(5.0) + m_RandomLocalizationDensity(.005), + m_InhibitionRadius(5.0), + m_NbMaxIteration(10000) { this->SetNumberOfRequiredInputs(1); this->SetNumberOfRequiredOutputs(1); @@ -114,16 +115,17 @@ LabeledSampleLocalizationGenerator<TVectorData> //std::cout << "insiders: " << insiders.size() << std::endl; // Search parametrization - unsigned int nbMaxIter = (unsigned int)(node->GetPolygonExteriorRing()->GetArea()); -// - insiders.size() * CONST_PI * vcl_pow(this->GetInhibitionRadius(), 2)) -// / (CONST_PI * vcl_pow(this->GetInhibitionRadius(), 2))); - //std::cout << "nbMaxIter: " << nbMaxIter << std::endl; - - unsigned int nbMaxPosition = (unsigned int)(nbMaxIter * this->GetRandomLocalizationDensity()); + //unsigned int nbMaxIter = (unsigned int)(node->GetPolygonExteriorRing()->GetArea()); + // - insiders.size() * CONST_PI * vcl_pow(this->GetInhibitionRadius(), 2)) + // / (CONST_PI * vcl_pow(this->GetInhibitionRadius(), 2))); + + unsigned int nbMaxPosition = (unsigned int)(node->GetPolygonExteriorRing()->GetArea() * this->GetRandomLocalizationDensity()); + + //std::cout << "nbMaxIter: " << this->GetNbMaxIteration() << std::endl; //std::cout << "nbMaxPosition: " << nbMaxPosition << std::endl; // Generation - unsigned int nbIter = nbMaxIter; + unsigned long int nbIter = this->GetNbMaxIteration(); unsigned int nbPosition = nbMaxPosition; PointType rangeMin,rangeMax; diff --git a/Code/ObjectDetection/otbObjectDetectionClassifier.txx b/Code/ObjectDetection/otbObjectDetectionClassifier.txx index 985236fa072615ef1ecb89eb6b78b9d6f32a7e15..1c58ba1fa1ecb02dcad08721235e55af3227948d 100644 --- a/Code/ObjectDetection/otbObjectDetectionClassifier.txx +++ b/Code/ObjectDetection/otbObjectDetectionClassifier.txx @@ -132,7 +132,7 @@ PersistentObjectDetectionClassifier<TInputImage,TOutputVectorData,TLabel,TFuncti { // merge all points in a single vector data //std::copy(m_ThreadPointArray[0].begin(), m_ThreadPointArray[0].end(), - // std::ostream_iterator<DescriptorsFunctionPointType>(std::cout, "\n") ); + //std::ostream_iterator<DescriptorsFunctionPointType>(std::cout, "\n") ); VectorDataType* vdata = this->GetOutputVectorData(); @@ -231,17 +231,14 @@ PersistentObjectDetectionClassifier<TInputImage,TOutputVectorData,TLabel,TFuncti } - - template <class TInputImage, class TOutputVectorData, class TLabel, class TFunctionType> void PersistentObjectDetectionClassifier<TInputImage,TOutputVectorData,TLabel,TFunctionType> ::ThreadedGenerateData(const RegionType& outputRegionForThread, int threadId) { -#define LOGG(t) std::cout << #t << " : " << t << std::endl - - SVMModelType* model = static_cast<SVMModelType*>(this->itk::ProcessObject::GetInput(1)); + InputImageType* input = static_cast<InputImageType*>(this->itk::ProcessObject::GetInput(0)); + SVMModelType* model = static_cast<SVMModelType*>(this->itk::ProcessObject::GetInput(1)); typedef typename RegionType::IndexType IndexType; typedef typename RegionType::IndexValueType IndexValueType; @@ -264,27 +261,19 @@ PersistentObjectDetectionClassifier<TInputImage,TOutputVectorData,TLabel,TFuncti point[0] = current[0]; point[1] = current[1]; - //LOGG(point); DescriptorType descriptor = m_DescriptorsFunction->Evaluate(point); - //LOGG(descriptor); SVMModelMeasurementType modelMeasurement(descriptor.GetSize()); for (unsigned int i = 0; i < descriptor.GetSize(); ++i) { modelMeasurement[i] = (descriptor[i] - m_Shifts[i]) * m_InvertedScales[i]; - -/* - LOGG(i); - LOGG(descriptor[i]); - LOGG(m_Shifts[i]); - LOGG(m_InvertedScales[i]); - LOGG( modelMeasurement[i]); -*/ } LabelType label = model->EvaluateLabel(modelMeasurement); - //LOGG(label); + if (label != m_NoClassLabel) { - m_ThreadPointArray[threadId].push_back(std::make_pair(point, label)); + DescriptorsFunctionPointType phyPoint; + input->TransformIndexToPhysicalPoint(current, phyPoint); + m_ThreadPointArray[threadId].push_back(std::make_pair(phyPoint, label)); } } } diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 265a4b7a2a9185669cddf5ad2e2fdd86a4346ae9..68047a4d5713771575c01663e8747223e629adfd 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -2,20 +2,50 @@ OTB-v.3.8.0 - Changes since version 3.6.0 (????/??/??) ----------------------------------------- * Monteverdi - * + * New Polarimetric Synthesis module + * New DEM image extraction / HillShading module: creates an image from a DEM tiles directory, with optional hillshading + * New ColorMapping module: apply a colormap to a mono band image + * Viewer module: add multi input support, with slideshow or transparency mode, add more rendering functions, add splitted/packed layout option + * Vectorization module: new semi-automatic mode based on segmentation results proposals * Applications - * + * Object Detection applications (see also http://wiki.orfeo-toolbox.org/index.php/Object_detection) + * EstimateFeatureStatistics to evaluate descriptors statistics on a set of images + * TrainObjectDetector: generates an SVM model from input images and a vector data + * ObjectDetector: detects points in an image from an SVM model + * Add automatically generated GUI wrappers for OTB processing chains + * Add FLTK wrapper + * Add a generic Qt based widget class + * Add a Qt GUI wrapper based on the generic Qt widget + * Add a Qgis plugin wrapper based on the generic Qt widget * Library - * Rework FlusserImageFunction andHuImageFunction to output all moments in one pass - * Rework RealMomentsImagefilter and ComplexMomentImageFilter to output a matrix of all moments associated to p, q inferior to a given parameter - * Add RadiometricMomentsImage function that output a vector containing the local mean, variance, skewness and kurtosis - + * Improved local descriptors tools based on ImageFunction : + * Rework FlusserImageFunction and HuImageFunction to output all moments in one pass (FlusserMomentsImageFunction, HuMomentsImageFunction) + * Rework RealMomentsImagefilter and ComplexMomentImageFilter to output a matrix of all moments associated to p, q inferior to a given parameter (ComplexMomentsImageFunction, HuMomentsImageFunction) + * Add image function to compute a vector containing the local mean, variance, skewness and kurtosis (RadiometricMomentsImageFunction) + * Add local histogram image function (LocalHistogramImageFunction) + * Add image function to compute the local Fourier Mellin coefficients (FourierMellinDescriptorsImageFunction) + * Add a class to adapt any image function return types to itk::VariableLengthVector (ImageFunctionAdaptor) + * Add a class to build composite image functions (MetaImageFunction) + * New object detection framework (see also http://wiki.orfeo-toolbox.org/index.php/Object_detection) + * Add filter to generate negative samples (LabeledSampleLocalizationGenerator) + * Add filter to evaluate an image function on a set of point and generate ListSample (DescriptorsListSampleGenerator) + * Add filter to balance the sample number of different classes in a ListSample by generating new samples from existing ones plus noise (ListSampleToBalancedListSampleFilter, GaussianAdditiveNoiseSampleListFilter) + * Add filter to apply a shift/scale to a ListSample (ShiftScaleSampleListFilter) + * Add filter to detect object from an SVM model and an image function (ObjectDetectionClassifier) + * SVMClassifier: add hyperplanes distances as output + * GDALImageIO: support writing of non-streamable format (JPEG, PNG) + * Support reading vector images of std::complex + * BandMathFilter: add physical and image coordinates variables * System * Internal liblas updated to 1.6.0b2 + OTB patches (root CMakeList.txt) - + * Internal libsvm updated to 3.0 + OTB patches (additionnal kernels) + * Internal ITK: removed compilation of medical image formats library and associated ImageIO + * Internal ITK: removed dependency on libtiff, libjpeg, libpng and zlib, now handled by gdal + * Support for gcc-4.5 + OTB-v.3.6.0 - Changes since version 3.4.0 (2010/10/07) ----------------------------------------- diff --git a/Testing/Code/FeatureExtraction/otbImageFunctionAdaptor.cxx b/Testing/Code/FeatureExtraction/otbImageFunctionAdaptor.cxx index 2f7fc61774aaa657d4f2f5a7d969a92d3ffb8d3d..c55e6a1cabf49f894652419e50d32c5bb038c02b 100644 --- a/Testing/Code/FeatureExtraction/otbImageFunctionAdaptor.cxx +++ b/Testing/Code/FeatureExtraction/otbImageFunctionAdaptor.cxx @@ -136,159 +136,214 @@ int otbImageFunctionAdaptor(int argc, char * argv[]) // Content testing double error = 0.0; - FMDFunction->SetInputImage(reader->GetOutput()); - FMDFunction->SetNeighborhoodRadius(5); - FMDFunction->SetPmax(5); - FMDFunction->SetQmax(5); - FMDFunctionType::OutputType resultFMD = FMDFunction->EvaluateAtIndex(index); - - FMDadaptedFunction->SetInputImage(reader->GetOutput()); - FMDadaptedFunction->GetInternalImageFunction()->SetNeighborhoodRadius(5); - FMDadaptedFunction->GetInternalImageFunction()->SetPmax(5); - FMDadaptedFunction->GetInternalImageFunction()->SetQmax(5); - FMDImageFunctionAdaptorType::OutputType resultAdaptedFMD = FMDadaptedFunction->EvaluateAtIndex(index); - rsltIdx = 0; - for (unsigned int i=0; i<=5; i++) + try { - for (unsigned int j=0; j<=5; j++) + FMDFunction->SetInputImage(reader->GetOutput()); + FMDFunction->SetNeighborhoodRadius(5); + FMDFunction->SetPmax(5); + FMDFunction->SetQmax(5); + FMDFunctionType::OutputType resultFMD = FMDFunction->EvaluateAtIndex(index); + + FMDadaptedFunction->SetInputImage(reader->GetOutput()); + FMDadaptedFunction->GetInternalImageFunction()->SetNeighborhoodRadius(5); + FMDadaptedFunction->GetInternalImageFunction()->SetPmax(5); + FMDadaptedFunction->GetInternalImageFunction()->SetQmax(5); + FMDImageFunctionAdaptorType::OutputType resultAdaptedFMD = FMDadaptedFunction->EvaluateAtIndex(index); + + rsltIdx = 0; + for (unsigned int i = 0; i <= 5; i++) { - error += vcl_pow(vcl_abs(resultAdaptedFMD[rsltIdx] - resultFMD.at(i).at(j)), 2); - - std::cout << "resultAdaptedFMD : " << resultAdaptedFMD[rsltIdx] - << "\t - resultFMD : " << resultFMD.at(i).at(j) << std::endl; - rsltIdx ++; + for (unsigned int j = 0; j <= 5; j++) + { + error += vcl_pow(vcl_abs(resultAdaptedFMD[rsltIdx] - resultFMD.at(i).at(j)), 2); + + std::cout << "resultAdaptedFMD : " << resultAdaptedFMD[rsltIdx] + << "\t - resultFMD : " << resultFMD.at(i).at(j) << std::endl; + rsltIdx++; + } } } + catch (itk::ExceptionObject& err) + { + std::cout << "ExceptionObject caught for FMDadaptedFunction() !" << std::endl; + std::cout << err << std::endl; + } - RMFunction->SetInputImage(reader->GetOutput()); - RMFunction->SetNeighborhoodRadius(5); - RMFunction->SetPmax(5); - RMFunction->SetQmax(5); - RMFunctionType::OutputType resultRM = RMFunction->EvaluateAtIndex(index); - - RMadaptedFunction->SetInputImage(reader->GetOutput()); - RMadaptedFunction->GetInternalImageFunction()->SetNeighborhoodRadius(5); - RMadaptedFunction->GetInternalImageFunction()->SetPmax(5); - RMadaptedFunction->GetInternalImageFunction()->SetQmax(5); - RMImageFunctionAdaptorType::OutputType resultAdaptedRM = RMadaptedFunction->EvaluateAtIndex(index); - - rsltIdx = 0; - for (unsigned int i=0; i<=5; i++) + + try { - for (unsigned int j=0; j<=5; j++) + RMFunction->SetInputImage(reader->GetOutput()); + RMFunction->SetNeighborhoodRadius(5); + RMFunction->SetPmax(5); + RMFunction->SetQmax(5); + RMFunctionType::OutputType resultRM = RMFunction->EvaluateAtIndex(index); + + RMadaptedFunction->SetInputImage(reader->GetOutput()); + RMadaptedFunction->GetInternalImageFunction()->SetNeighborhoodRadius(5); + RMadaptedFunction->GetInternalImageFunction()->SetPmax(5); + RMadaptedFunction->GetInternalImageFunction()->SetQmax(5); + RMImageFunctionAdaptorType::OutputType resultAdaptedRM = RMadaptedFunction->EvaluateAtIndex(index); + + rsltIdx = 0; + for (unsigned int i = 0; i <= 5; i++) { - error += vcl_pow(vcl_abs(resultAdaptedRM[rsltIdx] - resultRM.at(i).at(j)), 2); + for (unsigned int j = 0; j <= 5; j++) + { + error += vcl_pow(vcl_abs(resultAdaptedRM[rsltIdx] - resultRM.at(i).at(j)), 2); - std::cout << "resultAdaptedRM : " << resultAdaptedRM[rsltIdx] - << "\t - resultRM : " << resultRM.at(i).at(j) << std::endl; - rsltIdx ++; + std::cout << "resultAdaptedRM : " << resultAdaptedRM[rsltIdx] << "\t - resultRM : " << resultRM.at(i).at(j) + << std::endl; + rsltIdx++; + } } } + catch (itk::ExceptionObject& err) + { + std::cout << "ExceptionObject caught for RMFunction() !" << std::endl; + std::cout << err << std::endl; + } - CMFunction->SetInputImage(reader->GetOutput()); - CMFunction->SetNeighborhoodRadius(5); - CMFunction->SetPmax(5); - CMFunction->SetQmax(5); - CMFunctionType::OutputType resultCM = CMFunction->EvaluateAtIndex(index); - - CMadaptedFunction->SetInputImage(reader->GetOutput()); - CMadaptedFunction->GetInternalImageFunction()->SetNeighborhoodRadius(5); - CMadaptedFunction->GetInternalImageFunction()->SetPmax(5); - CMadaptedFunction->GetInternalImageFunction()->SetQmax(5); - CMImageFunctionAdaptorType::OutputType resultAdaptedCM = CMadaptedFunction->EvaluateAtIndex(index); - - rsltIdx = 0; - for (unsigned int i=0; i<=5; i++) + try { - for (unsigned int j=0; j<=5; j++) + CMFunction->SetInputImage(reader->GetOutput()); + CMFunction->SetNeighborhoodRadius(5); + CMFunction->SetPmax(5); + CMFunction->SetQmax(5); + CMFunctionType::OutputType resultCM = CMFunction->EvaluateAtIndex(index); + + CMadaptedFunction->SetInputImage(reader->GetOutput()); + CMadaptedFunction->GetInternalImageFunction()->SetNeighborhoodRadius(5); + CMadaptedFunction->GetInternalImageFunction()->SetPmax(5); + CMadaptedFunction->GetInternalImageFunction()->SetQmax(5); + CMImageFunctionAdaptorType::OutputType resultAdaptedCM = CMadaptedFunction->EvaluateAtIndex(index); + + rsltIdx = 0; + for (unsigned int i = 0; i <= 5; i++) { - error += vcl_pow(vcl_abs(resultAdaptedCM[rsltIdx] - resultCM.at(i).at(j).real()), 2); - std::cout << "resultAdaptedCM : (" << resultAdaptedCM[rsltIdx] - << "," << resultAdaptedCM[rsltIdx+1] << ")" - << "\t - resultCM : " << resultCM.at(i).at(j) << std::endl; - rsltIdx ++; - error += vcl_pow(vcl_abs(resultAdaptedCM[rsltIdx] - resultCM.at(i).at(j).imag()), 2); - rsltIdx ++; + for (unsigned int j = 0; j <= 5; j++) + { + error += vcl_pow(vcl_abs(resultAdaptedCM[rsltIdx] - resultCM.at(i).at(j).real()), 2); + std::cout << "resultAdaptedCM : (" << resultAdaptedCM[rsltIdx] << "," << resultAdaptedCM[rsltIdx + 1] << ")" + << "\t - resultCM : " << resultCM.at(i).at(j) << std::endl; + rsltIdx++; + error += vcl_pow(vcl_abs(resultAdaptedCM[rsltIdx] - resultCM.at(i).at(j).imag()), 2); + rsltIdx++; + } } } + catch (itk::ExceptionObject& err) + { + std::cout << "ExceptionObject caught for CMadaptedFunction() !" << std::endl; + std::cout << err << std::endl; + } - FMFunction->SetInputImage(reader->GetOutput()); - FMFunction->SetNeighborhoodRadius(5); - FMFunctionType::OutputType resultFM = FMFunction->EvaluateAtIndex(index); - - FMadaptedFunction->SetInputImage(reader->GetOutput()); - FMadaptedFunction->GetInternalImageFunction()->SetNeighborhoodRadius(5); - FMImageFunctionAdaptorType::OutputType resultAdaptedFM = FMadaptedFunction->EvaluateAtIndex(index); - - rsltIdx = 0; - for (unsigned int i=0; i<11; i++) + try { + FMFunction->SetInputImage(reader->GetOutput()); + FMFunction->SetNeighborhoodRadius(5); + FMFunctionType::OutputType resultFM = FMFunction->EvaluateAtIndex(index); + + FMadaptedFunction->SetInputImage(reader->GetOutput()); + FMadaptedFunction->GetInternalImageFunction()->SetNeighborhoodRadius(5); + FMImageFunctionAdaptorType::OutputType resultAdaptedFM = FMadaptedFunction->EvaluateAtIndex(index); + + rsltIdx = 0; + for (unsigned int i = 0; i < 11; i++) + { error += vcl_pow(vcl_abs(resultAdaptedFM[rsltIdx] - resultFM[i]), 2); - std::cout << "resultAdaptedFM : " << resultAdaptedFM[rsltIdx] - << "\t - resultFM : " << resultFM[i] << std::endl; - rsltIdx ++; + std::cout << "resultAdaptedFM : " << resultAdaptedFM[rsltIdx] << "\t - resultFM : " << resultFM[i] << std::endl; + rsltIdx++; + } + } + catch (itk::ExceptionObject& err) + { + std::cout << "ExceptionObject caught for FMFunction() !" << std::endl; + std::cout << err << std::endl; } - HMFunction->SetInputImage(reader->GetOutput()); - HMFunction->SetNeighborhoodRadius(5); - HMFunctionType::OutputType resultHM = HMFunction->EvaluateAtIndex(index); - - HMadaptedFunction->SetInputImage(reader->GetOutput()); - HMadaptedFunction->GetInternalImageFunction()->SetNeighborhoodRadius(5); - HMImageFunctionAdaptorType::OutputType resultAdaptedHM = HMadaptedFunction->EvaluateAtIndex(index); - - rsltIdx = 0; - for (unsigned int i=0; i<7; i++) + try { - error += vcl_pow(vcl_abs(resultAdaptedHM[rsltIdx] - resultHM[i]), 2); + HMFunction->SetInputImage(reader->GetOutput()); + HMFunction->SetNeighborhoodRadius(5); + HMFunctionType::OutputType resultHM = HMFunction->EvaluateAtIndex(index); + + HMadaptedFunction->SetInputImage(reader->GetOutput()); + HMadaptedFunction->GetInternalImageFunction()->SetNeighborhoodRadius(5); + HMImageFunctionAdaptorType::OutputType resultAdaptedHM = HMadaptedFunction->EvaluateAtIndex(index); + + rsltIdx = 0; + for (unsigned int i = 0; i < 7; i++) + { + error += vcl_pow(vcl_abs(resultAdaptedHM[rsltIdx] - resultHM[i]), 2); - std::cout << "resultAdaptedHM : " << resultAdaptedHM[rsltIdx] - << "\t - resultHM : " << resultHM[i] << std::endl; - rsltIdx ++; + std::cout << "resultAdaptedHM : " << resultAdaptedHM[rsltIdx] << "\t - resultHM : " << resultHM[i] << std::endl; + rsltIdx++; + } + } + catch (itk::ExceptionObject& err) + { + std::cout << "ExceptionObject caught for HMFunction() !" << std::endl; + std::cout << err << std::endl; } - RaMFunction->SetInputImage(reader->GetOutput()); - RaMFunction->SetNeighborhoodRadius(5); - RaMFunctionType::OutputType resultRaM = RaMFunction->EvaluateAtIndex(index); - - RaMadaptedFunction->SetInputImage(reader->GetOutput()); - RaMadaptedFunction->GetInternalImageFunction()->SetNeighborhoodRadius(5); - RaMImageFunctionAdaptorType::OutputType resultAdaptedRaM = RaMadaptedFunction->EvaluateAtIndex(index); - - rsltIdx = 0; - for (unsigned int i=0; i<4; i++) - { - error += vcl_pow(vcl_abs(resultAdaptedRaM[rsltIdx] - resultRaM[i]), 2); - - std::cout << "resultAdaptedRaM : " << resultAdaptedRaM[rsltIdx] - << "\t - resultRaM : " << resultRaM[i] << std::endl; - rsltIdx ++; + try + { + RaMFunction->SetInputImage(reader->GetOutput()); + RaMFunction->SetNeighborhoodRadius(5); + RaMFunctionType::OutputType resultRaM = RaMFunction->EvaluateAtIndex(index); + + RaMadaptedFunction->SetInputImage(reader->GetOutput()); + RaMadaptedFunction->GetInternalImageFunction()->SetNeighborhoodRadius(5); + RaMImageFunctionAdaptorType::OutputType resultAdaptedRaM = RaMadaptedFunction->EvaluateAtIndex(index); + + rsltIdx = 0; + for (unsigned int i = 0; i < 4; i++) + { + error += vcl_pow(vcl_abs(resultAdaptedRaM[rsltIdx] - resultRaM[i]), 2); + + std::cout << "resultAdaptedRaM : " << resultAdaptedRaM[rsltIdx] << "\t - resultRaM : " << resultRaM[i] + << std::endl; + rsltIdx++; + } + } + catch (itk::ExceptionObject& err) + { + std::cout << "ExceptionObject caught for RaMFunction() !" << std::endl; + std::cout << err << std::endl; } - LHFunction->SetInputImage(reader->GetOutput()); - LHFunction->SetNeighborhoodRadius(5); - LHFunction->SetNumberOfHistogramBins(64); - LHFunction->SetHistogramMin(filter->GetMinimum()); - LHFunction->SetHistogramMax(filter->GetMaximum()); - LHFunctionType::OutputType resultLH = LHFunction->EvaluateAtIndex(index); - - LHadaptedFunction->SetInputImage(reader->GetOutput()); - LHadaptedFunction->GetInternalImageFunction()->SetNeighborhoodRadius(5); - LHadaptedFunction->GetInternalImageFunction()->SetNumberOfHistogramBins(64); - LHadaptedFunction->GetInternalImageFunction()->SetHistogramMin(filter->GetMinimum()); - LHadaptedFunction->GetInternalImageFunction()->SetHistogramMax(filter->GetMaximum()); - LHImageFunctionAdaptorType::OutputType resultAdaptedLH = LHadaptedFunction->EvaluateAtIndex(index); - - rsltIdx = 0; - for (unsigned int i=0; i<64; i++) + try { - error += vcl_pow(vcl_abs( resultAdaptedLH[rsltIdx] - resultLH->GetFrequency(i)), 2); + LHFunction->SetInputImage(reader->GetOutput()); + LHFunction->SetNeighborhoodRadius(5); + LHFunction->SetNumberOfHistogramBins(64); + LHFunction->SetHistogramMin(filter->GetMinimum()); + LHFunction->SetHistogramMax(filter->GetMaximum()); + LHFunctionType::OutputType resultLH = LHFunction->EvaluateAtIndex(index); + + LHadaptedFunction->SetInputImage(reader->GetOutput()); + LHadaptedFunction->GetInternalImageFunction()->SetNeighborhoodRadius(5); + LHadaptedFunction->GetInternalImageFunction()->SetNumberOfHistogramBins(64); + LHadaptedFunction->GetInternalImageFunction()->SetHistogramMin(filter->GetMinimum()); + LHadaptedFunction->GetInternalImageFunction()->SetHistogramMax(filter->GetMaximum()); + LHImageFunctionAdaptorType::OutputType resultAdaptedLH = LHadaptedFunction->EvaluateAtIndex(index); + + rsltIdx = 0; + for (unsigned int i = 0; i < 64; i++) + { + error += vcl_pow(vcl_abs(resultAdaptedLH[rsltIdx] - resultLH->GetFrequency(i)), 2); - std::cout << "resultAdaptedLH : " << resultAdaptedLH[rsltIdx] - << "\t - resultLH : " << resultLH->GetFrequency(i) << std::endl; - rsltIdx ++; + std::cout << "resultAdaptedLH : " << resultAdaptedLH[rsltIdx] << "\t - resultLH : " << resultLH->GetFrequency(i) + << std::endl; + rsltIdx++; + } + } + catch (itk::ExceptionObject& err) + { + std::cout << "ExceptionObject caught for LHFunction() !" << std::endl; + std::cout << err << std::endl; } error = vcl_sqrt(error); @@ -303,29 +358,36 @@ int otbImageFunctionAdaptor(int argc, char * argv[]) // Testing the use of a user defined InternalImageFunction instead // of the build-in InternalImageFunction - FMDFunctionType::Pointer myFunction = FMDFunctionType::New(); - FMDImageFunctionAdaptorType::Pointer myAdaptedFunction = FMDImageFunctionAdaptorType::New(); - - myFunction->SetNeighborhoodRadius(8); - myFunction->SetPmax(2); - myFunction->SetQmax(2); - - myAdaptedFunction->SetInputImage(reader->GetOutput()); - myAdaptedFunction->SetInternalImageFunction(myFunction); - FMDImageFunctionAdaptorType::OutputType myResult = myAdaptedFunction->EvaluateAtIndex(index); - - rsltIdx = 0; - for (unsigned int i=0; i<=2; i++) + try { - for (unsigned int j=0; j<=2; j++) + FMDFunctionType::Pointer myFunction = FMDFunctionType::New(); + FMDImageFunctionAdaptorType::Pointer myAdaptedFunction = FMDImageFunctionAdaptorType::New(); + + myFunction->SetNeighborhoodRadius(8); + myFunction->SetPmax(2); + myFunction->SetQmax(2); + + myAdaptedFunction->SetInputImage(reader->GetOutput()); + myAdaptedFunction->SetInternalImageFunction(myFunction); + FMDImageFunctionAdaptorType::OutputType myResult = myAdaptedFunction->EvaluateAtIndex(index); + + rsltIdx = 0; + for (unsigned int i = 0; i <= 2; i++) { - std::cout << "myResult: " << myResult[rsltIdx] << std::endl; - rsltIdx ++; + for (unsigned int j = 0; j <= 2; j++) + { + std::cout << "myResult: " << myResult[rsltIdx] << std::endl; + rsltIdx++; + } } + std::cout << myAdaptedFunction << std::endl; + } + catch (itk::ExceptionObject& err) + { + std::cout << "ExceptionObject caught for FMDFunctionType() !" << std::endl; + std::cout << err << std::endl; } - std::cout << myAdaptedFunction << std::endl; - return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/CMakeLists.txt b/Testing/Code/IO/CMakeLists.txt index f7e593f458adde5c8b51d2af2ddbfda7f3aaf0e2..27591828d0c22a2a4831429d09da9d883328d65d 100644 --- a/Testing/Code/IO/CMakeLists.txt +++ b/Testing/Code/IO/CMakeLists.txt @@ -122,12 +122,18 @@ ADD_TEST(ioTvImageFileReaderWithComplexPixel_RADARSAT ${IO_TESTS1} ${TEMP}/ioImageFileReaderWithComplexPixel_RADARSAT.tif 0 0 100 100) -ADD_TEST(ioTvImageFileReaderCompareComplexPixelWithFloatPixel_PALSAR ${IO_TESTS1} - otbImageFileReaderCompareComplexPixelWithFloatPixelTest +ADD_TEST(ioTvCompareWritingComplexImage_TIF ${IO_TESTS1} + otbCompareWritingComplexImageTest ${LARGEDATA}/PALSAR/200801280007/l1data/VOL-ALPSRP037120700-H1.1__A ${TEMP}/ioTvImageFileReaderCompareComplexPixelWithFloatPixel_PALSAR.tif 0 0 100 100) +ADD_TEST(ioTvCompareWritingComplexImage_HDR ${IO_TESTS1} + otbCompareWritingComplexImageTest + ${LARGEDATA}/PALSAR/200801280007/l1data/VOL-ALPSRP037120700-H1.1__A + ${TEMP}/ioTvImageFileReaderCompareComplexPixelWithFloatPixel_PALSAR.hdr + 0 0 100 100) + ENDIF(OTB_DATA_USE_LARGEINPUT) # ------- TEST IO COMMON ------------------------------ @@ -2692,7 +2698,7 @@ otbImageFileReaderTestFloat.cxx otbShortImageIOTest.cxx otbImageIOFactoryNew.cxx otbImageFileReaderWithComplexPixel.cxx -otbImageFileReaderCompareComplexPixelWithFloatPixel.cxx +otbCompareWritingComplexImage.cxx ) SET(BasicIO_SRCS2 otbIOTests2.cxx diff --git a/Testing/Code/IO/otbImageFileReaderCompareComplexPixelWithFloatPixel.cxx b/Testing/Code/IO/otbCompareWritingComplexImage.cxx similarity index 98% rename from Testing/Code/IO/otbImageFileReaderCompareComplexPixelWithFloatPixel.cxx rename to Testing/Code/IO/otbCompareWritingComplexImage.cxx index c5407fbb1b88f59f1b17e2c8ce1aaf8ce99bd23a..ad0eb5c661289037b0f6298071cb3d2130a808d6 100644 --- a/Testing/Code/IO/otbImageFileReaderCompareComplexPixelWithFloatPixel.cxx +++ b/Testing/Code/IO/otbCompareWritingComplexImage.cxx @@ -33,7 +33,7 @@ #include "itkComplexToImaginaryImageFilter.h" -int otbImageFileReaderCompareComplexPixelWithFloatPixelTest(int argc, char* argv[]) +int otbCompareWritingComplexImageTest(int argc, char* argv[]) { if (argc < 7) { diff --git a/Testing/Code/IO/otbIOTests1.cxx b/Testing/Code/IO/otbIOTests1.cxx index 0498e2e8f8704186741ab33b39d829c690b73c6a..e8f9950b678abc96a4548d23a351eed133c2c0f0 100644 --- a/Testing/Code/IO/otbIOTests1.cxx +++ b/Testing/Code/IO/otbIOTests1.cxx @@ -35,5 +35,5 @@ void RegisterTests() REGISTER_TEST(otbShortImageIOTest); REGISTER_TEST(otbImageIOFactoryNew); REGISTER_TEST(otbImageFileReaderWithComplexPixelTest); - REGISTER_TEST(otbImageFileReaderCompareComplexPixelWithFloatPixelTest); + REGISTER_TEST(otbCompareWritingComplexImageTest); } diff --git a/Testing/Code/ObjectDetection/CMakeLists.txt b/Testing/Code/ObjectDetection/CMakeLists.txt index 4ab5028ad9d6703959b753d964493c31c31d8e41..65333ff743097c470cc923bc5e37550461e5ec91 100644 --- a/Testing/Code/ObjectDetection/CMakeLists.txt +++ b/Testing/Code/ObjectDetection/CMakeLists.txt @@ -94,6 +94,19 @@ ADD_TEST(odTvObjectDetectionClassifier ${OBJECTDETECTION_TESTS1} 5 # neighborhood radius ) +ADD_TEST(odTvObjectDetectionClassifierStreaming ${OBJECTDETECTION_TESTS1} + --compare-ogr ${NOTOL} + ${BASELINE_FILES}/TvObjectDetectionClassifierOutput.shp + ${TEMP}/TvObjectDetectionClassifierOutput.shp + otbObjectDetectionClassifier + ${INPUTDATA}/ObjectReco/Boats/maur_B010202_01_extract_amplitude.tif + ${INPUTDATA}/ObjectReco/Boats/FeatureStats_RadiometricMoments_amplitude.xml + ${BASELINE_FILES}/TvDescriptorsSVMModelCreation.svm + ${TEMP}/TvObjectDetectionClassifierOutput.shp + 50 # streaming + 5 # neighborhood radius + ) + ADD_TEST(odTuStandardMetaImageFunctionBuilderNew ${OBJECTDETECTION_TESTS1} otbStandardMetaImageFunctionBuilderNew ) diff --git a/Testing/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.cxx b/Testing/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.cxx index cac3d605d6f33d20da267f842e41d381fea8888e..08d91bda76c7859eb588a01b3bf800a4ad2b338b 100644 --- a/Testing/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.cxx +++ b/Testing/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.cxx @@ -67,7 +67,8 @@ int otbLabeledSampleLocalizationGenerator(int argc, char* argv[]) generator->SetClassKey("Class"); generator->SetNoClassIdentifier(0); generator->SetInhibitionRadius(5); - generator->SetRandomLocalizationDensity(0.05); + generator->SetRandomLocalizationDensity(0.004); + generator->SetNbMaxIteration(1000); generator->Update();