17 m_gtif_driver = GetGDALDriverManager()->GetDriverByName(
"GTiff");
31 std::cout <<
timestamp <<
"GeoTIFF dataset not initialized!" << std::endl;
35 uint16_t *rowBuff = (uint16_t *) CPLMalloc(
sizeof(uint16_t) *
m_cols);
36 for (
int row = 0; row <
m_rows; row++)
38 for (
int col = 0; col <
m_cols; col++)
40 rowBuff[col] = mat->at<uint16_t>(row, col);
43 GF_Write, 0, row,
m_cols, 1, rowBuff,
m_cols, 1, GDT_UInt16, 0, 0) != CPLE_None)
45 std::cout <<
timestamp <<
"An error occurred in GDAL while writing band "
46 << band <<
" in row " << row <<
"." << std::endl;
93 int nXSize = band->GetXSize();
94 int nYSize = band->GetYSize();
95 uint16_t *buf = (uint16_t *) CPLMalloc(
sizeof(uint16_t) * nXSize * nYSize);
97 CPLErr
error = band->RasterIO(GF_Read, 0, 0, nXSize, nYSize, buf, nXSize, nYSize, GDT_UInt16, 0, 0);
99 cv::Mat *mat =
new cv::Mat(nXSize, nYSize, CV_16UC1, buf);
105 std::cout <<
timestamp <<
"Error getting raster band" << std::endl;
114 GDALDestroyDriverManager();