Skip to content

Commit 476d2e1

Browse files
committed
Merge pull request opencv#8140 from StevenPuttemans:fix_gdal_driver_4channel_16bit
2 parents 976ee44 + 22d8a81 commit 476d2e1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/imgcodecs/src/grfmt_gdal.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,11 @@ void write_pixel( const double& pixelValue,
308308
// input: 4 channel, output: 4 channel
309309
else if( gdalChannels == 4 && image.channels() == 4 ){
310310
if( image.depth() == CV_8U ){ image.at<Vec4b>(row,col)[channel] = newValue; }
311+
else if( image.depth() == CV_16U ){ image.at<Vec4s>(row,col)[channel] = newValue; }
312+
else if( image.depth() == CV_16S ){ image.at<Vec4s>(row,col)[channel] = newValue; }
313+
else if( image.depth() == CV_32S ){ image.at<Vec4i>(row,col)[channel] = newValue; }
314+
else if( image.depth() == CV_32F ){ image.at<Vec4f>(row,col)[channel] = newValue; }
315+
else if( image.depth() == CV_64F ){ image.at<Vec4d>(row,col)[channel] = newValue; }
311316
else{ throw std::runtime_error("Unknown image depth, gdal: 4, image: 4"); }
312317
}
313318

@@ -574,4 +579,4 @@ bool GdalDecoder::checkSignature( const String& signature )const{
574579

575580
} /// End of cv Namespace
576581

577-
#endif /**< End of HAVE_GDAL Definition */
582+
#endif /**< End of HAVE_GDAL Definition */

0 commit comments

Comments
 (0)