From 9a0e038a48d33b2fa729428ff5a8184b0023cae0 Mon Sep 17 00:00:00 2001 From: Marvin Smith Date: Sat, 17 Jan 2015 20:37:51 -0800 Subject: [PATCH] Fixed compile warning from redefined macro. --- modules/imgcodecs/CMakeLists.txt | 1 - modules/imgcodecs/src/grfmt_gdal.cpp | 13 +++++++++++-- modules/imgcodecs/src/grfmt_gdal.hpp | 14 ++++++++++---- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/modules/imgcodecs/CMakeLists.txt b/modules/imgcodecs/CMakeLists.txt index 893a2c1c91..3d0110ef48 100644 --- a/modules/imgcodecs/CMakeLists.txt +++ b/modules/imgcodecs/CMakeLists.txt @@ -51,7 +51,6 @@ if(HAVE_OPENEXR) endif() if(HAVE_GDAL) - add_definitions(-DHAVE_GDAL) include_directories(SYSTEM ${GDAL_INCLUDE_DIR}) list(APPEND GRFMT_LIBS ${GDAL_LIBRARY}) endif() diff --git a/modules/imgcodecs/src/grfmt_gdal.cpp b/modules/imgcodecs/src/grfmt_gdal.cpp index b0caa7bd09..0311630950 100644 --- a/modules/imgcodecs/src/grfmt_gdal.cpp +++ b/modules/imgcodecs/src/grfmt_gdal.cpp @@ -39,10 +39,16 @@ // //M*/ #include "precomp.hpp" -#include "grfmt_gdal.hpp" + +// GDAL Macros +#include "cvconfig.h" #ifdef HAVE_GDAL +// Our Header +#include "grfmt_gdal.hpp" + + /// C++ Standard Libraries #include #include @@ -196,7 +202,10 @@ GdalDecoder::~GdalDecoder(){ /** * Convert data range */ -double range_cast( const GDALDataType& gdalType, const int& cvDepth, const double& value ){ +double range_cast( const GDALDataType& gdalType, + const int& cvDepth, + const double& value ) +{ // uint8 -> uint8 if( gdalType == GDT_Byte && cvDepth == CV_8U ){ diff --git a/modules/imgcodecs/src/grfmt_gdal.hpp b/modules/imgcodecs/src/grfmt_gdal.hpp index b2cd224467..73d39c9470 100644 --- a/modules/imgcodecs/src/grfmt_gdal.hpp +++ b/modules/imgcodecs/src/grfmt_gdal.hpp @@ -42,16 +42,15 @@ #ifndef __GRFMT_GDAL_HPP__ #define __GRFMT_GDAL_HPP__ +/// OpenCV FMT Base Type +#include "grfmt_base.hpp" + /// Macro to make sure we specified GDAL in CMake #ifdef HAVE_GDAL /// C++ Libraries #include -/// OpenCV Libraries -#include "grfmt_base.hpp" -#include "precomp.hpp" - /// Geospatial Data Abstraction Library #include #include @@ -61,6 +60,13 @@ /// Start of CV Namespace namespace cv { +/** + * Convert GDAL Pixel Range to OpenCV Pixel Range +*/ +double range_cast( const GDALDataType& gdalType, + const int& cvDepth, + const double& value ); + /** * Convert GDAL Palette Interpretation to OpenCV Pixel Type */