Commit 08b30580 authored by Sergey Alexandrov's avatar Sergey Alexandrov

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.
parent e0395a79
...@@ -79,9 +79,11 @@ public: ...@@ -79,9 +79,11 @@ public:
response = linearResponse(channels); response = linearResponse(channels);
response.at<Vec3f>(0) = response.at<Vec3f>(1); response.at<Vec3f>(0) = response.at<Vec3f>(1);
} }
log(response, response);
CV_Assert(response.rows == LDR_SIZE && response.cols == 1 && Mat log_response;
response.channels() == channels); log(response, log_response);
CV_Assert(log_response.rows == LDR_SIZE && log_response.cols == 1 &&
log_response.channels() == channels);
Mat exp_values(times); Mat exp_values(times);
log(exp_values, exp_values); log(exp_values, exp_values);
...@@ -103,7 +105,7 @@ public: ...@@ -103,7 +105,7 @@ public:
w /= channels; w /= channels;
Mat response_img; Mat response_img;
LUT(images[i], response, response_img); LUT(images[i], log_response, response_img);
split(response_img, splitted); split(response_img, splitted);
for(int c = 0; c < channels; c++) { for(int c = 0; c < channels; c++) {
result_split[c] += w.mul(splitted[c] - exp_values.at<float>((int)i)); result_split[c] += w.mul(splitted[c] - exp_values.at<float>((int)i));
......
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