From 08b30580b7d703918760da2f993fee979687bfa0 Mon Sep 17 00:00:00 2001 From: Sergey Alexandrov Date: Mon, 14 Dec 2015 22:24:14 +0100 Subject: [PATCH] Do not modify input parameter in MergeDebevec MergeDebevec takes camera response function as an optional input parameter. Despite being clearly marked as input, this matrix is overwritten during processing. This commit adds a temporary matrix to store the log response and avoid modification of the input. --- modules/photo/src/merge.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/photo/src/merge.cpp b/modules/photo/src/merge.cpp index 295e03c95f..23d7d7cea0 100644 --- a/modules/photo/src/merge.cpp +++ b/modules/photo/src/merge.cpp @@ -79,9 +79,11 @@ public: response = linearResponse(channels); response.at(0) = response.at(1); } - log(response, response); - CV_Assert(response.rows == LDR_SIZE && response.cols == 1 && - response.channels() == channels); + + Mat log_response; + log(response, log_response); + CV_Assert(log_response.rows == LDR_SIZE && log_response.cols == 1 && + log_response.channels() == channels); Mat exp_values(times); log(exp_values, exp_values); @@ -103,7 +105,7 @@ public: w /= channels; Mat response_img; - LUT(images[i], response, response_img); + LUT(images[i], log_response, response_img); split(response_img, splitted); for(int c = 0; c < channels; c++) { result_split[c] += w.mul(splitted[c] - exp_values.at((int)i));