SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
Encapsulates a GEOTiff images with geo referenced meta information. More...
#include <CVImageGeoTiff.h>
Public Member Functions | |
CVImageGeoTiff () | |
~CVImageGeoTiff () | |
void | loadGeoTiff (const string &filename) |
Loads a GEOTiff file into the OpenCV image matrix. More... | |
CVVec3d | upperLeftLatLonAlt () const |
CVVec3d | lowerRightLatLonAlt () const |
float | getAltitudeAtLatLon (double lat, double lon) const |
Returns the altitude in m at the given position in WGS84 latitude-longitude. More... | |
Public Member Functions inherited from CVImage | |
CVImage () | |
Default constructor. More... | |
CVImage (int width, int height, CVPixelFormatGL format, string name) | |
Constructor for empty image of a certain format and size. More... | |
CVImage (const string &imageFilename, bool flipVertical=true, bool loadGrayscaleIntoAlpha=false) | |
Constructor for image from file. More... | |
CVImage (CVImage &srcImage) | |
Copy constructor from a source image. More... | |
CVImage (const CVVVec3f &colors) | |
Creates a 1D image from a CVVec3f color vector. More... | |
CVImage (const CVVVec4f &colors) | |
~CVImage () | |
void | clearData () |
Deletes all data and resets the image parameters. More... | |
bool | allocate (int width, int height, CVPixelFormatGL pixelFormatGL, bool isContinuous=true) |
Memory allocation function. More... | |
void | load (const string &filename, bool flipVertical=true, bool loadGrayscaleIntoAlpha=false) |
Loads the image with the appropriate image loader. More... | |
bool | load (int inWidth, int inHeight, CVPixelFormatGL srcPixelFormatGL, CVPixelFormatGL dstPixelFormatGL, uchar *data, bool isContinuous, bool isTopLeft) |
loads an image from a memory with format change. More... | |
void | savePNG (const string &filename, int compressionLevel=6, bool flipY=true, bool convertBGR2RGB=true) |
Save as PNG at a certain compression level (0-9) More... | |
void | saveJPG (const string &filename, int compressionLevel=95, bool flipY=true, bool convertBGR2RGB=true) |
Save as JPG at a certain compression level (0-100) More... | |
CVVec4f | getPixeli (int x, int y) |
getPixeli returns the pixel color at the integer pixel coordinate x, y More... | |
CVVec4f | getPixelf (float x, float y) |
void | setPixeli (int x, int y, CVVec4f color) |
setPixeli sets the RGB pixel color at the integer pixel coordinate x, y More... | |
void | setPixeliRGB (int x, int y, CVVec3f color) |
setPixeli sets the RGB pixel color at the integer pixel coordinate x, y More... | |
void | setPixeliRGB (int x, int y, CVVec4f color) |
setPixeli sets the RGB pixel color at the integer pixel coordinate x, y More... | |
void | setPixeliRGBA (int x, int y, CVVec4f color) |
setPixeli sets the RGBA pixel color at the integer pixel coordinate x, y More... | |
void | resize (int width, int height) |
void | convertTo (int cvDataType) |
Converts the data type of the cvMat. More... | |
void | flipX () |
Flip X coordinates used to make JPEGs from top-left to bottom-left images. More... | |
void | flipY () |
Flip Y coordinates used to make JPEGs from top-left to bottom-left images. More... | |
void | fill (uchar r, uchar g, uchar b) |
Fills the image with a certain rgb color. More... | |
void | fill (uchar r, uchar g, uchar b, uchar a) |
Fills the image with a certain rgba color. More... | |
void | crop (float targetWdivH, int &cropW, int &cropH) |
string | name () |
CVMat | cvMat () const |
uchar * | data () |
bool | empty () const |
uint | width () |
uint | height () |
uint | bytesPerPixel () |
uint | bytesPerLine () |
uint | bytesPerImage () |
uint | bytesInFile () |
CVPixelFormatGL | format () |
string | formatString () |
string | path () |
Private Attributes | |
CVVec3d | _upperleftLatLonAlt |
CVVec3d | _lowerRightLatLonAlt |
Upper-left corner of DEM in WGS84 coords. More... | |
double | _noDataValue |
Lower-right corner of DEM in WGS84 coords. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from CVImage | |
static CVPixelFormatGL | cvType2glPixelFormat (int cvType) |
Converts OpenCV mat type to OpenGL pixel format. More... | |
static int | glPixelFormat2cvType (CVPixelFormatGL pixelFormatGL) |
Converts OpenGL pixel format to OpenCV mat type. More... | |
static string | formatString (CVPixelFormatGL pixelFormatGL) |
Returns the pixel format as string. More... | |
static string | typeString (int cvMatTypeInt) |
Returns the cv::Mat.type()) as string. More... | |
Static Protected Member Functions inherited from CVImage | |
static uint | bytesPerPixel (CVPixelFormatGL pixelFormat) |
Returns the NO. of bytes per pixel for the passed pixel format. More... | |
static uint | bytesPerLine (uint width, CVPixelFormatGL pixelFormat, bool isContinuous=false) |
Returns the NO. of bytes per image line for the passed pixel format. More... | |
Protected Attributes inherited from CVImage | |
string | _name |
Image name (e.g. from the filename) More... | |
CVMat | _cvMat |
OpenCV mat matrix image type. More... | |
CVPixelFormatGL | _format |
OpenGL pixel format. More... | |
uint | _bytesPerPixel |
Number of bytes per pixel. More... | |
uint | _bytesPerLine |
Number of bytes per line (stride) More... | |
uint | _bytesPerImage |
Number of bytes per image. More... | |
uint | _bytesInFile |
Number of bytes in file. More... | |
string | _path |
path on the filesystem More... | |
Encapsulates a GEOTiff images with geo referenced meta information.
A GEOTiff image can hold per pixel the height information of a "rectangular" area on earth that is defined with upper-left and lower-left corner in longitude and latitude coordinates. With the loadGeoTiff function only GeoTiffs with WGS84 (EPSG 4326) coordinates can be loaded. GeoTiff with other coordinate reference systems e.g. the Swiss LV95 can be converted first in tools such as QGIS. Because we can not load the meta information with OpenCV we have to store them in a separate json file with the same name. They are generated with a tool that comes with QGIS as follows: gdalinfo -json DTM-Aventicum-WGS84.tif > DTM-Aventicum-WGS84.json
Definition at line 27 of file CVImageGeoTiff.h.
CVImageGeoTiff::CVImageGeoTiff | ( | ) |
Definition at line 18 of file CVImageGeoTiff.cpp.
CVImageGeoTiff::~CVImageGeoTiff | ( | ) |
Definition at line 23 of file CVImageGeoTiff.cpp.
float CVImageGeoTiff::getAltitudeAtLatLon | ( | double | lat, |
double | lon | ||
) | const |
Returns the altitude in m at the given position in WGS84 latitude-longitude.
Definition at line 137 of file CVImageGeoTiff.cpp.
void CVImageGeoTiff::loadGeoTiff | ( | const string & | filename | ) |
Loads a GEOTiff file into the OpenCV image matrix.
Definition at line 29 of file CVImageGeoTiff.cpp.
|
inline |
Definition at line 35 of file CVImageGeoTiff.h.
|
inline |
Definition at line 34 of file CVImageGeoTiff.h.
|
private |
Upper-left corner of DEM in WGS84 coords.
Definition at line 40 of file CVImageGeoTiff.h.
|
private |
Lower-right corner of DEM in WGS84 coords.
Definition at line 41 of file CVImageGeoTiff.h.
|
private |
Definition at line 39 of file CVImageGeoTiff.h.