27 #include "../Config.h" 37 #define BOOST_TEST_NO_MAIN 38 #include <boost/test/unit_test.hpp> 39 #include <boost/lexical_cast.hpp> 40 #include <boost/timer.hpp> 48 std::map<std::string, std::string> auxRasterInfo;
50 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop1.tif";
53 BOOST_CHECK( inputRasterPtrPointer.get() );
59 boost::numeric::ublas::matrix<double> glcm;
60 glcm = attributesInstance.getGLCM( *inputRasterPtrPointer, 0, 1, 1, 0, 255, 256 );
62 te::rp::Texture glcmMetrics = attributesInstance.getGLCMMetrics( glcm );
64 BOOST_REQUIRE_CLOSE( glcmMetrics.
m_contrast, 4.0108956721513795, 0.00001 );
65 BOOST_REQUIRE_CLOSE( glcmMetrics.
m_dissimilarity, 1.3006917202426418, 0.00001 );
66 BOOST_REQUIRE_CLOSE( glcmMetrics.
m_energy, 0.098389689308334138, 0.00001 );
67 BOOST_REQUIRE_CLOSE( glcmMetrics.
m_entropy, 5.1017890175144585, 0.00001 );
68 BOOST_REQUIRE_CLOSE( glcmMetrics.
m_homogeneity, 0.53576701787364245, 0.00001 );
71 BOOST_AUTO_TEST_SUITE_END()
double m_energy
GLCM metric Energy (the square root of Angular Second Moment) ${{i,j=0}^{N-1}P_{i,j}^2}$.
Extraction of attributes from Raster, Bands, and Polygons.
double m_homogeneity
GLCM metric Homogeneity (also called Inverse Difference Moment) ${i,j=0}^{N-1}{P_{i,j}}{1+(i-j)^2}$.
double m_dissimilarity
GLCM metric Dissimilarity ${i,j=0}^{N-1}P_{i,j}|i-j|$.
This file contains include headers for the TerraLib Raster Processing module.
BOOST_AUTO_TEST_SUITE(raster_attributes_tests) BOOST_AUTO_TEST_CASE(getGLCMMetrics_test)
double m_entropy
GLCM metric Entropy ${i,j=0}^{N-1}P_{i,j}(-{P_{i,j}})$.
double m_contrast
GLCM metric Contrast (also called Sum of Squares Variance) ${i,j=0}^{N-1}P_{i,j}(i-j)^2$.
BOOST_AUTO_TEST_CASE(encoding_test_utf8_latin1)
A structure to hold the set of GLCM metrics.
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.