Commit 476d2e1e authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #8140 from StevenPuttemans:fix_gdal_driver_4channel_16bit

parents 976ee446 22d8a81a
......@@ -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 */
\ No newline at end of file
#endif /**< End of HAVE_GDAL Definition */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment