21 std::cout <<
"Region growing Segmentation example using Raster Processing module." << std::endl << std::endl;
24 std::string data_dir = TERRALIB_DATA_DIR;
26 std::cout <<
"Inform your input image (ENTER to accept default \'" << (data_dir +
"/geotiff/cbers2b_rgb342_crop.tif") <<
"\'): ";
27 std::getline (std::cin, aux);
28 std::map<std::string, std::string> rinfo;
32 rinfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers2b_rgb342_crop.tif";
37 std::cout <<
"Inform your output image (ENTER to accept default \'" << (data_dir +
"/geotiff/cbers2b_rgb342_crop_segmentedMean.tif") <<
"\'): ";
38 std::getline (std::cin, aux);
39 std::map<std::string, std::string> orinfo;
43 orinfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers2b_rgb342_crop_segmentedMean.tif";
67 algoOutputParameters.
m_rInfo = orinfo;
68 algoOutputParameters.
m_rType =
"GDAL";
73 if( !seginstance.
initialize( algoInputParameters ) )
throw;
74 if( !seginstance.
execute( algoOutputParameters ) )
throw;
79 std::cout <<
"Done!" << std::endl << std::endl;
81 catch(
const std::exception& e)
83 std::cout << std::endl <<
"An exception has occurred in Segmenter(): " << e.what() << std::endl;
87 std::cout << std::endl <<
"An unexpected exception has occurred in Segmenter()!" << std::endl;
95 std::cout <<
"Region growing Segmentation (Baatz features) example using Raster Processing module." << std::endl << std::endl;
98 std::string data_dir = TERRALIB_DATA_DIR;
100 std::cout <<
"Inform your input image (ENTER to accept default \'" << (data_dir +
"/geotiff/cbers2b_rgb342_crop.tif") <<
"\'): ";
101 std::getline (std::cin, aux);
102 std::map<std::string, std::string> rinfo;
106 rinfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers2b_rgb342_crop.tif";
111 std::cout <<
"Inform your output image (ENTER to accept default \'" << (data_dir +
"/geotiff/cbers2b_rgb342_crop_segmentedBaatz.tif") <<
"\'): ";
112 std::getline (std::cin, aux);
113 std::map<std::string, std::string> orinfo;
117 orinfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers2b_rgb342_crop_segmentedBaatz.tif";
144 algoOutputParameters.
m_rInfo = orinfo;
145 algoOutputParameters.
m_rType =
"GDAL";
150 if( ! seginstance.
initialize(algoInputParameters) )
throw;
151 if( ! seginstance.
execute( algoOutputParameters ) )
throw;
156 std::cout <<
"Done!" << std::endl << std::endl;
158 catch(
const std::exception& e)
160 std::cout << std::endl <<
"An exception has occurred in Segmenter(): " << e.what() << std::endl;
164 std::cout << std::endl <<
"An unexpected exception has occurred in Segmenter()!" << std::endl;
This file contains include headers for the memory data source of TerraLib.
Segmenter Output Parameters.
double m_segmentsSimilarityThreshold
Segments similarity treshold - Use lower values to merge only those segments that are more similar - ...
These routines show how to use the RP (raster processing) module.
std::vector< double > m_bandsWeights
The weight given to each band, when applicable (note: the bands weights sum must always be 1) or an e...
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
double m_compactnessWeight
The weight given to the compactness component, deafult:0.5, valid range: [0,1].
double m_colorWeight
The weight given to the color component, deafult:0.9, valid range: [0,1].
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
unsigned int m_minSegmentSize
A positive minimum segment size (pixels number - default: 100).
An abstract class for raster data strucutures.
This file contains include headers for the TerraLib Raster Processing module.
double m_segmentsSimilarityThreshold
Segments similarity treshold - Use lower values to merge only those segments that are more similar - ...
unsigned int m_minSegmentSize
A positive minimum segment size (pixels number - default: 100).
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory).
This file contains include headers for the Vector Geometry model of TerraLib.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
This file contains include headers for the Data Access module of TerraLib.
static Raster * open(const std::map< std::string, std::string > &rinfo, te::common::AccessPolicy p=te::common::RAccess)
It opens a raster with the given parameters and default raster driver.