27 #include "../Config.h" 34 #define BOOST_TEST_NO_MAIN 35 #include <boost/test/unit_test.hpp> 36 #include <boost/shared_ptr.hpp> 44 std::map<std::string, std::string> auxRasterInfo;
46 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/L5219075_07520040503_r3g2b1.tif";
49 BOOST_CHECK( inputRaster1Pointer.get() );
51 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/L5219076_07620040908_r3g2b1.tif";
54 BOOST_CHECK( inputRaster2Pointer.get() );
56 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/L71218075_07520070614_r3g2b1.tif";
59 BOOST_CHECK( inputRaster3Pointer.get() );
61 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/L71218076_07620060814_r3g2b1.tif";
64 BOOST_CHECK( inputRaster4Pointer.get() );
70 std::vector< const te::rst::Raster* >
rasters;
71 rasters.push_back( inputRaster1Pointer.get() );
72 rasters.push_back( inputRaster2Pointer.get() );
73 rasters.push_back( inputRaster3Pointer.get() );
74 rasters.push_back( inputRaster4Pointer.get() );
76 algoInputParams.m_feederRasterPtr = &feeder;
78 std::vector< unsigned int >
bands;
82 algoInputParams.m_inputRastersBands.push_back( bands );
83 algoInputParams.m_inputRastersBands.push_back( bands );
84 algoInputParams.m_inputRastersBands.push_back( bands );
85 algoInputParams.m_inputRastersBands.push_back( bands );
88 algoInputParams.m_noDataValue = 0;
89 algoInputParams.m_forceInputNoDataValue =
true;
91 algoInputParams.m_autoEqualize =
true;
95 algoOutputParams.
m_rInfo[
"URI"] =
96 "terralib_unittest_rp_Mosaic_GeoReferencedImagesMosaic_Test.tif";
97 algoOutputParams.
m_rType =
"GDAL";
103 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
104 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
111 std::map<std::string, std::string> auxRasterInfo;
113 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop1.tif";
116 BOOST_CHECK( inputRaster1Pointer.get() );
118 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop2.tif";
121 BOOST_CHECK( inputRaster2Pointer.get() );
123 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop3_EPSG_22522.tif";
126 BOOST_CHECK( inputRaster3Pointer.get() );
132 std::vector< const te::rst::Raster* >
rasters;
133 rasters.push_back( inputRaster1Pointer.get() );
134 rasters.push_back( inputRaster2Pointer.get() );
135 rasters.push_back( inputRaster3Pointer.get() );
137 algoInputParams.m_feederRasterPtr = &feeder;
139 std::vector< unsigned int >
bands;
140 bands.push_back( 0 );
141 bands.push_back( 1 );
142 bands.push_back( 2 );
143 algoInputParams.m_inputRastersBands.push_back( bands );
148 algoInputParams.m_inputRastersBands.push_back( bands );
153 algoInputParams.m_inputRastersBands.push_back( bands );
156 algoInputParams.m_noDataValue = 0;
157 algoInputParams.m_forceInputNoDataValue =
false;
159 algoInputParams.m_autoEqualize =
true;
163 algoOutputParams.
m_rInfo[
"URI"] =
164 "terralib_unittest_rp_GeoReferencedImagesMosaicWithReprojectionTest_Test.tif";
165 algoOutputParams.
m_rType =
"GDAL";
171 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
172 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
179 std::map<std::string, std::string> auxRasterInfo;
181 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop1.tif";
184 BOOST_CHECK( inputRaster1Pointer.get() );
186 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop2.tif";
189 BOOST_CHECK( inputRaster2Pointer.get() );
191 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop3_EPSG_22522.tif";
194 BOOST_CHECK( inputRaster3Pointer.get() );
200 std::vector< const te::rst::Raster* >
rasters;
201 rasters.push_back( inputRaster1Pointer.get() );
202 rasters.push_back( inputRaster2Pointer.get() );
203 rasters.push_back( inputRaster3Pointer.get() );
205 algoInputParams.m_feederRasterPtr = &feeder;
207 std::vector< unsigned int >
bands;
208 bands.push_back( 0 );
209 bands.push_back( 1 );
210 bands.push_back( 2 );
211 algoInputParams.m_inputRastersBands.push_back( bands );
216 algoInputParams.m_inputRastersBands.push_back( bands );
221 algoInputParams.m_inputRastersBands.push_back( bands );
225 std::vector< te::gm::GTParameters::TiePoint > r0ToR1tiePoints( 3 );
226 r0ToR1tiePoints[ 0 ].first.x = 40;
227 r0ToR1tiePoints[ 0 ].first.y = 38;
228 r0ToR1tiePoints[ 0 ].second.x = 334;
229 r0ToR1tiePoints[ 0 ].second.y = 575;
230 r0ToR1tiePoints[ 1 ].first.x = 465;
231 r0ToR1tiePoints[ 1 ].first.y = 71;
232 r0ToR1tiePoints[ 1 ].second.x = 759;
233 r0ToR1tiePoints[ 1 ].second.y = 608;
234 r0ToR1tiePoints[ 2 ].first.x = 496;
235 r0ToR1tiePoints[ 2 ].first.y = 429;
236 r0ToR1tiePoints[ 2 ].second.x = 789;
237 r0ToR1tiePoints[ 2 ].second.y = 964;
238 algoInputParams.m_tiePoints.push_back( r0ToR1tiePoints );
242 std::vector< te::gm::GTParameters::TiePoint > r1ToR2tiePoints( 3 );
243 r1ToR2tiePoints[ 0 ].first.x = 476;
244 r1ToR2tiePoints[ 0 ].first.y = 358;
245 r1ToR2tiePoints[ 0 ].second.x = 4;
246 r1ToR2tiePoints[ 0 ].second.y = 183;
247 r1ToR2tiePoints[ 1 ].first.x = 590;
248 r1ToR2tiePoints[ 1 ].first.y = 930;
249 r1ToR2tiePoints[ 1 ].second.x = 117;
250 r1ToR2tiePoints[ 1 ].second.y = 754;
251 r1ToR2tiePoints[ 2 ].first.x = 717;
252 r1ToR2tiePoints[ 2 ].first.y = 666;
253 r1ToR2tiePoints[ 2 ].second.x = 244;
254 r1ToR2tiePoints[ 2 ].second.y = 492;
255 algoInputParams.m_tiePoints.push_back( r1ToR2tiePoints );
257 algoInputParams.m_tiePointsLinkType =
261 algoInputParams.m_noDataValue = 0;
263 algoInputParams.m_autoEqualize =
true;
267 algoOutputParams.
m_rInfo[
"URI"] =
268 "terralib_unittest_rp_Mosaic_TiePointsMosaicTest1_Test.tif";
269 algoOutputParams.
m_rType =
"GDAL";
275 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
276 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
283 std::map<std::string, std::string> auxRasterInfo;
285 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/jpeg/cbers_rgb342_crop1.jpg";
288 BOOST_CHECK( inputRaster1Pointer.get() );
290 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/jpeg/cbers_rgb342_crop2.jpg";
293 BOOST_CHECK( inputRaster2Pointer.get() );
295 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/jpeg/cbers_rgb342_crop3.jpg";
298 BOOST_CHECK( inputRaster3Pointer.get() );
304 std::vector< const te::rst::Raster* >
rasters;
305 rasters.push_back( inputRaster1Pointer.get() );
306 rasters.push_back( inputRaster2Pointer.get() );
307 rasters.push_back( inputRaster3Pointer.get() );
309 algoInputParams.m_feederRasterPtr = &feeder;
311 std::vector< unsigned int >
bands;
312 bands.push_back( 0 );
313 bands.push_back( 1 );
314 bands.push_back( 2 );
315 algoInputParams.m_inputRastersBands.push_back( bands );
320 algoInputParams.m_inputRastersBands.push_back( bands );
325 algoInputParams.m_inputRastersBands.push_back( bands );
329 std::vector< te::gm::GTParameters::TiePoint > r0ToR1tiePoints( 3 );
330 r0ToR1tiePoints[ 0 ].first.x = 40;
331 r0ToR1tiePoints[ 0 ].first.y = 38;
332 r0ToR1tiePoints[ 0 ].second.x = 334;
333 r0ToR1tiePoints[ 0 ].second.y = 575;
334 r0ToR1tiePoints[ 1 ].first.x = 465;
335 r0ToR1tiePoints[ 1 ].first.y = 71;
336 r0ToR1tiePoints[ 1 ].second.x = 759;
337 r0ToR1tiePoints[ 1 ].second.y = 608;
338 r0ToR1tiePoints[ 2 ].first.x = 496;
339 r0ToR1tiePoints[ 2 ].first.y = 429;
340 r0ToR1tiePoints[ 2 ].second.x = 789;
341 r0ToR1tiePoints[ 2 ].second.y = 964;
342 algoInputParams.m_tiePoints.push_back( r0ToR1tiePoints );
346 std::vector< te::gm::GTParameters::TiePoint > r1ToR2tiePoints( 3 );
347 r1ToR2tiePoints[ 0 ].first.x = 476;
348 r1ToR2tiePoints[ 0 ].first.y = 358;
349 r1ToR2tiePoints[ 0 ].second.x = 4;
350 r1ToR2tiePoints[ 0 ].second.y = 183;
351 r1ToR2tiePoints[ 1 ].first.x = 590;
352 r1ToR2tiePoints[ 1 ].first.y = 930;
353 r1ToR2tiePoints[ 1 ].second.x = 117;
354 r1ToR2tiePoints[ 1 ].second.y = 754;
355 r1ToR2tiePoints[ 2 ].first.x = 717;
356 r1ToR2tiePoints[ 2 ].first.y = 666;
357 r1ToR2tiePoints[ 2 ].second.x = 244;
358 r1ToR2tiePoints[ 2 ].second.y = 492;
359 algoInputParams.m_tiePoints.push_back( r1ToR2tiePoints );
361 algoInputParams.m_tiePointsLinkType =
365 algoInputParams.m_noDataValue = 0;
367 algoInputParams.m_autoEqualize =
true;
371 algoOutputParams.
m_rInfo[
"URI"] =
372 "terralib_unittest_rp_Mosaic_TiePointsMosaicTest2_Test.tif";
373 algoOutputParams.
m_rType =
"GDAL";
379 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
380 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
387 std::map<std::string, std::string> auxRasterInfo;
389 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/jpeg/cbers_rgb342_crop1.jpg";
392 BOOST_CHECK( inputRaster1Pointer.get() );
394 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/jpeg/cbers_rgb342_crop2.jpg";
397 BOOST_CHECK( inputRaster2Pointer.get() );
399 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/jpeg/cbers_rgb342_crop3.jpg";
402 BOOST_CHECK( inputRaster3Pointer.get() );
408 std::vector< const te::rst::Raster* >
rasters;
409 rasters.push_back( inputRaster1Pointer.get() );
410 rasters.push_back( inputRaster2Pointer.get() );
411 rasters.push_back( inputRaster3Pointer.get() );
413 algoInputParams.m_feederRasterPtr = &feeder;
415 std::vector< unsigned int >
bands;
416 bands.push_back( 0 );
417 bands.push_back( 1 );
418 bands.push_back( 2 );
419 algoInputParams.m_inputRastersBands.push_back( bands );
424 algoInputParams.m_inputRastersBands.push_back( bands );
429 algoInputParams.m_inputRastersBands.push_back( bands );
431 algoInputParams.m_geomTransfName =
"Affine";
435 algoInputParams.m_noDataValue = 0.0;
437 algoInputParams.m_forceInputNoDataValue =
false;
441 algoInputParams.m_autoEqualize =
true;
443 algoInputParams.m_useRasterCache =
true;
445 algoInputParams.m_enableMultiThread =
true;
447 algoInputParams.m_enableProgress =
true;
449 algoInputParams.m_locatorParams.m_geomTransfMaxError = 1.0;
451 algoInputParams.m_tiePointsLocationBandIndex = 0;
453 algoInputParams.m_locatorParams.m_maxTiePoints = 500;
455 algoInputParams.m_outDataSetsNamePrefix =
456 "terralib_unittest_rp_Mosaic_SequenceMosaic_Test_";
458 algoInputParams.m_outDataSetsNameSufix =
".tif";
460 algoInputParams.m_minRequiredTiePointsCoveredAreaPercent = 1;
464 std::string connInfoRaster(
"file://.");
466 BOOST_CHECK( dsPtr.get() );
468 BOOST_CHECK( dsPtr->isOpened() );
475 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
476 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
479 BOOST_CHECK( algoOutputParams.
m_sequencesInfo[ 0 ].m_rasterFeederIndexes.size() == 1 );
480 BOOST_CHECK( algoOutputParams.
m_sequencesInfo[ 0 ].m_rasterFeederIndexes[ 0 ] == 0 );
481 BOOST_CHECK( algoOutputParams.
m_sequencesInfo[ 1 ].m_rasterFeederIndexes.size() == 2 );
482 BOOST_CHECK( algoOutputParams.
m_sequencesInfo[ 1 ].m_rasterFeederIndexes[ 0 ] == 1 );
483 BOOST_CHECK( algoOutputParams.
m_sequencesInfo[ 1 ].m_rasterFeederIndexes[ 1 ] == 2 );
484 BOOST_CHECK( algoOutputParams.
m_sequencesInfo[ 0 ].m_tiePoints.size() == 1 );
485 BOOST_CHECK( algoOutputParams.
m_sequencesInfo[ 1 ].m_tiePoints.size() == 2 );
488 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(geoReferencedImagesMosaicWithReprojection_test)
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
Near neighborhood interpolation method.
A feeder from a input rasters vector;.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
Mosaic output parameters.
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
Create a mosaic from a set of geo-referenced rasters.
An abstract class for raster data strucutures.
std::vector< MosaicSequenceInfo > m_sequencesInfo
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
bool execute(AlgorithmOutputParameters &outputParams) _NOEXCEPT_OP(false)
Executes the algorithm using the supplied parameters.
This is the abstract factory for Rasters.
BOOST_AUTO_TEST_SUITE(mosaic_tests) BOOST_AUTO_TEST_CASE(geoReferencedImagesMosaic_test)
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
A factory for data sources.
This file contains include headers for the TerraLib Raster Processing module.
Create a mosaic from a set of rasters using tie-points.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
bool initialize(const AlgorithmInputParameters &inputParams) _NOEXCEPT_OP(false)
Initialize the algorithm instance making it ready for execution.
GeoMosaic output parameters.
Mosaic output parameters.
Create mosaics from a sequence of overlapped rasters using an automatic tie-points detection method...
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
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.
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
te::da::DataSource * m_outputDSPtr
The mosaic sequences info.