1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

Merge pull request #8140 from StevenPuttemans:fix_gdal_driver_4channel_16bit

This commit is contained in:
Alexander Alekhin
2017-02-08 11:29:34 +00:00
+6 -1
View File
@@ -308,6 +308,11 @@ void write_pixel( const double& pixelValue,
// input: 4 channel, output: 4 channel
else if( gdalChannels == 4 && image.channels() == 4 ){
if( image.depth() == CV_8U ){ image.at<Vec4b>(row,col)[channel] = newValue; }
else if( image.depth() == CV_16U ){ image.at<Vec4s>(row,col)[channel] = newValue; }
else if( image.depth() == CV_16S ){ image.at<Vec4s>(row,col)[channel] = newValue; }
else if( image.depth() == CV_32S ){ image.at<Vec4i>(row,col)[channel] = newValue; }
else if( image.depth() == CV_32F ){ image.at<Vec4f>(row,col)[channel] = newValue; }
else if( image.depth() == CV_64F ){ image.at<Vec4d>(row,col)[channel] = newValue; }
else{ throw std::runtime_error("Unknown image depth, gdal: 4, image: 4"); }
}
@@ -574,4 +579,4 @@ bool GdalDecoder::checkSignature( const String& signature )const{
} /// End of cv Namespace
#endif /**< End of HAVE_GDAL Definition */
#endif /**< End of HAVE_GDAL Definition */