Commit 76eb3897 authored by pasbi's avatar pasbi Committed by Alexander Alekhin

Merge pull request #12240 from pasbi:pfm_fix

* fixed 64-float pfm auto conversion

* removed trailing whitespace
parent e9a1ccb8
...@@ -185,7 +185,9 @@ PFMEncoder::~PFMEncoder() ...@@ -185,7 +185,9 @@ PFMEncoder::~PFMEncoder()
bool PFMEncoder::isFormatSupported(int depth) const 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<int>& params) bool PFMEncoder::write(const Mat& img, const std::vector<int>& params)
...@@ -246,8 +248,8 @@ bool PFMEncoder::write(const Mat& img, const std::vector<int>& params) ...@@ -246,8 +248,8 @@ bool PFMEncoder::write(const Mat& img, const std::vector<int>& params)
rgb_row[x*3+1] = bgr_row[x*3+1]; rgb_row[x*3+1] = bgr_row[x*3+1];
rgb_row[x*3+2] = bgr_row[x*3+0]; rgb_row[x*3+2] = bgr_row[x*3+0];
} }
strm.putBytes( reinterpret_cast<const uchar*>(rgb_row.data()), strm.putBytes( reinterpret_cast<const uchar*>(rgb_row.data()),
static_cast<int>(sizeof(float) * row_size)); static_cast<int>(sizeof(float) * row_size) );
} else if (float_img.channels() == 1) { } else if (float_img.channels() == 1) {
strm.putBytes(float_img.ptr(y), sizeof(float) * float_img.cols); strm.putBytes(float_img.ptr(y), sizeof(float) * float_img.cols);
} }
......
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