Commit 2bcd4bbe authored by Manuel Grizonnet's avatar Manuel Grizonnet

Automated merge with http://hg.orfeo-toolbox.org/OTB

parents 296da2ae bb1a31af
......@@ -31,6 +31,9 @@
// Even though specific reader/writer for Shapefile and the Google KML
// are available in OTB, we designed a generic approach for the IO of
// this kind of data.
// The reader/writer for VectorData in OTB is able to access to a variety of
// vector file formats (all OGR supported formats)
//
// In section \ref{sec:VectorDataProjection}, you will find more information on
// how projections work for the vector data and how you can export
......@@ -260,4 +263,16 @@ int main(int argc, char * argv[])
// Software Guide : EndCodeSnippet
return EXIT_SUCCESS;
// Software Guide : BeginLatex
//
// This example can convert an ESRI Shapefile to
// a MapInfo File but you can also access with the same OTB source code
// to a PostgreSQL datasource,using a connection string as :
// PG:"dbname='databasename' host='addr' port='5432' user='x' password='y'"
// Starting with GDAL 1.6.0, the set of tables to be scanned can be overridden
// by specifying tables=[schema.]table[(geom_column_name)].
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
}
......@@ -48,6 +48,21 @@ ADD_TEST(trTeOBIAShapeAttributeComputationTest ${EXE_TESTS}
${INPUTDATA}/MSLabeledOutput.tif
${TEMP}/OBIAShapeAttribute.txt
)
ADD_TEST(trTeOBIARadiometricAttributesLabelMapFilterTest ${EXE_TESTS}
--compare-image ${TOL} ${BASELINE}/OBIARadiometricAttributes.tif
${TEMP}/OBIARadiometricAttributes.tif
OBIARadiometricAttributesTest
${INPUTDATA}/qb_RoadExtract2.tif
${TEMP}/OBIARadiometricAttributes.txt
STATS::Ndvi::Mean
0
0.3
16
16
200
1.0
)
#need to add the test of radiometric labelmap filter
......
......@@ -67,7 +67,7 @@ int main(int argc, char * argv[])
typedef itk::LabelImageToLabelMapFilter< ImageType, LabelMapType > ConverterType;
ConverterType::Pointer converter = ConverterType::New();
converter->SetInput( reader->GetOutput() );
// converter->SetForegroundValue( atoi(argv[2]) );
converter->SetBackgroundValue( itk::NumericTraits<LabelType>::min() );
typedef itk::ShapeLabelMapFilter< LabelMapType > ShapeFilterType;
ShapeFilterType::Pointer shape = ShapeFilterType::New();
......
......@@ -27,6 +27,7 @@ void RegisterTests()
{
REGISTER_TEST(OBIAImageToLabelToImageTest);
REGISTER_TEST(OBIAShapeAttributeComputationTest);
REGISTER_TEST(OBIARadiometricAttributesTest);
}
#undef main
......@@ -36,3 +37,7 @@ void RegisterTests()
#undef main
#define main OBIAShapeAttributeComputationTest
#include "ShapeAttributeComputation.cxx"
#undef main
#define main OBIARadiometricAttributesTest
#include "otbRadiometricAttributesLabelMapFilterExample.cxx"
......@@ -23,7 +23,29 @@
// Software Guide : BeginLatex
//
// This example shows the basic approch to perform
// This example shows the basic approch to perform object based analysis on a image.
// The input image is firstly segmented using the \doxygen{otb}{MeanShiftImageFilter}
// Then each segmented region is converted to a Map of labeled objects.
// After the \doxygen{otb}{RadiometricAttributesLabelMapFilter} computes computes
// radiometric attributes for each object.
// Images are supposed to be standard 4-bands image (B,G,R,NIR). The
// index of each channel can be set via the Set***ChannelIndex()
// accessors.
//
// This filter internally applies the
// StatisticsAttributesLabelMapFilter to the following features:
// \begin{itemize}
// \item GEMI
// \item NDVI
// \item IR
// \item IC
// \item IB
// \item NDWI2
// \item Intensity
// \item and original B, G, R and NIR channels
// \end{itemize},
// Here we use the \doxygen{otb}{AttributesMapOpeningLabelMapFilter} to extract vegetated areas.
//
//
// Software Guide : EndLatex
......@@ -87,19 +109,26 @@ int main(int argc, char * argv[])
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(reffname);
//std::cout << reffname << std::endl;
//reader->Update();
//std::cout << reffname << std::endl;
VectorReaderType::Pointer vreader = VectorReaderType::New();
vreader->SetFileName(reffname);
//Segment the ref image using Mean Shift
// Software Guide : BeginCodeSnippet
typedef otb::MeanShiftImageFilter<ImageType,ImageType, LabeledImageType> FilterType;
FilterType::Pointer filter = FilterType::New();
filter->SetSpatialRadius(spatialRadius);
filter->SetRangeRadius(rangeRadius);
filter->SetMinimumRegionSize(minRegionSize);
filter->SetScale(scale);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// The \doxygen{otb}{MeanShiftImageFilter} type is instantiated using the images
// types.
//
// Software Guide : EndLatex
filter->SetInput(reader->GetOutput());
LabelMapFilterType::Pointer labelMapFilter = LabelMapFilterType::New();
......@@ -118,9 +147,9 @@ int main(int argc, char * argv[])
RadiometricLabelMapFilterType::Pointer radiometricLabelMapFilter = RadiometricLabelMapFilterType::New();
radiometricLabelMapFilter->SetInput1(statisticsLabelMapFilter->GetOutput());
radiometricLabelMapFilter->SetInput2(vreader->GetOutput());
//radiometricLabelMapFilter->SetReducedAttributeSet(false);
radiometricLabelMapFilter->SetRedChannelIndex(1);
radiometricLabelMapFilter->SetNIRChannelIndex(2);
radiometricLabelMapFilter->SetRedChannelIndex(2);
radiometricLabelMapFilter->SetNIRChannelIndex(3);
radiometricLabelMapFilter->Update();
OpeningLabelMapFilterType::Pointer opening = OpeningLabelMapFilterType::New();
......
......@@ -20,11 +20,11 @@
#include "otbVectorDataFileWriter.h"
#include "otbVectorData.h"
#include "otbVectorDataProjectionFilter.h"
//#include "otbVectorDataExtractROI.h"
#include <fstream>
#include <iostream>
//#include "itkRGBAPixel.h"
#include "otbImage.h"
#include "otbLabelMapToVectorDataFilter.h"
#include "otbAttributesMapLabelObject.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment