From 76eb38976103c86610f73d87e46b7cb5a74f0017 Mon Sep 17 00:00:00 2001 From: pasbi Date: Fri, 17 Aug 2018 17:53:09 +0200 Subject: [PATCH] Merge pull request #12240 from pasbi:pfm_fix * fixed 64-float pfm auto conversion * removed trailing whitespace --- modules/imgcodecs/src/grfmt_pfm.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/imgcodecs/src/grfmt_pfm.cpp b/modules/imgcodecs/src/grfmt_pfm.cpp index d044042..f418016 100644 --- a/modules/imgcodecs/src/grfmt_pfm.cpp +++ b/modules/imgcodecs/src/grfmt_pfm.cpp @@ -185,7 +185,9 @@ PFMEncoder::~PFMEncoder() bool PFMEncoder::isFormatSupported(int depth) const { - return CV_MAT_DEPTH(depth) == CV_32F || CV_MAT_DEPTH(depth) == CV_8U; + // any depth will be converted into 32-bit float. + (void) depth; + return true; } bool PFMEncoder::write(const Mat& img, const std::vector& params) @@ -246,8 +248,8 @@ bool PFMEncoder::write(const Mat& img, const std::vector& params) rgb_row[x*3+1] = bgr_row[x*3+1]; rgb_row[x*3+2] = bgr_row[x*3+0]; } - strm.putBytes( reinterpret_cast(rgb_row.data()), - static_cast(sizeof(float) * row_size)); + strm.putBytes( reinterpret_cast(rgb_row.data()), + static_cast(sizeof(float) * row_size) ); } else if (float_img.channels() == 1) { strm.putBytes(float_img.ptr(y), sizeof(float) * float_img.cols); } -- 2.7.4