Skip to content

Commit 6df8ac0

Browse files
zhijackchenalalek
authored andcommitted
Merge pull request opencv#10283 from zhijackchen:exr_export
* Fix issue opencv#10114 Convert table change From: CV_8U -> HALF CV_8S -> HALF CV_16U -> UINT CV_16S -> UINT CV_32S -> UINT CV_32F -> FLOAT To: CV_8U -> HALF CV_8S -> HALF CV_16U -> UINT CV_16S -> FLOAT CV_32S -> FLOAT loss precision CV_32F -> FLOAT Signed integer can't be presented well with UINT. Even adjust bias, CV16S and CV32S will be confused when load from exr file. Also fix CV_8S negative value incorrect bug * EXR import and export imread() from EXR returns CV_32F only imwrite() accepts CV_32 cv::Mat only and stores FLOAT images by default. Add imwrite() flag to store in HALF format. * fix compiling error * clean up * fix EXR import issues
1 parent 18ff806 commit 6df8ac0

File tree

3 files changed

+125
-197
lines changed

3 files changed

+125
-197
lines changed

modules/imgcodecs/include/opencv2/imgcodecs.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,17 @@ enum ImwriteFlags {
8989
IMWRITE_PNG_STRATEGY = 17, //!< One of cv::ImwritePNGFlags, default is IMWRITE_PNG_STRATEGY_RLE.
9090
IMWRITE_PNG_BILEVEL = 18, //!< Binary level PNG, 0 or 1, default is 0.
9191
IMWRITE_PXM_BINARY = 32, //!< For PPM, PGM, or PBM, it can be a binary format flag, 0 or 1. Default value is 1.
92+
IMWRITE_EXR_TYPE = (3 << 4) + 0, /* 48 */ //!< override EXR storage type (FLOAT (FP32) is default)
9293
IMWRITE_WEBP_QUALITY = 64, //!< For WEBP, it can be a quality from 1 to 100 (the higher is the better). By default (without any parameter) and for quality above 100 the lossless compression is used.
9394
IMWRITE_PAM_TUPLETYPE = 128,//!< For PAM, sets the TUPLETYPE field to the corresponding string value that is defined for the format
9495
};
9596

97+
enum ImwriteEXRTypeFlags {
98+
/*IMWRITE_EXR_TYPE_UNIT = 0, //!< not supported */
99+
IMWRITE_EXR_TYPE_HALF = 1, //!< store as HALF (FP16)
100+
IMWRITE_EXR_TYPE_FLOAT = 2 //!< store as FP32 (default)
101+
};
102+
96103
//! Imwrite PNG specific flags used to tune the compression algorithm.
97104
/** These flags will be modify the way of PNG image compression and will be passed to the underlying zlib processing stage.
98105

modules/imgcodecs/include/opencv2/imgcodecs/imgcodecs_c.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ enum
9494
CV_IMWRITE_PNG_STRATEGY_RLE =3,
9595
CV_IMWRITE_PNG_STRATEGY_FIXED =4,
9696
CV_IMWRITE_PXM_BINARY =32,
97+
CV_IMWRITE_EXR_TYPE = 48,
9798
CV_IMWRITE_WEBP_QUALITY =64,
9899
CV_IMWRITE_PAM_TUPLETYPE = 128,
99100
CV_IMWRITE_PAM_FORMAT_NULL = 0,

0 commit comments

Comments
 (0)