mirror of
https://github.com/opencv/opencv.git
synced 2025-06-11 03:33:28 +08:00
Calibration, various changes
This commit is contained in:
commit
af2c9077f7
@ -99,7 +99,7 @@ CV_EXPORTS_W void makeHDR(InputArrayOfArrays srcImgs, const std::vector<float>&
|
|||||||
CV_EXPORTS_W void tonemap(InputArray src, OutputArray dst, int algorithm,
|
CV_EXPORTS_W void tonemap(InputArray src, OutputArray dst, int algorithm,
|
||||||
const std::vector<float>& params = std::vector<float>());
|
const std::vector<float>& params = std::vector<float>());
|
||||||
|
|
||||||
CV_EXPORTS_W void exposureFusion(InputArrayOfArrays srcImgs, OutputArray dst, float wc = 1, float ws = 1, float we = 0);
|
CV_EXPORTS_W void exposureFusion(InputArrayOfArrays srcImgs, OutputArray dst, float wc = 1.0f, float ws = 1.0f, float we = 0.0f);
|
||||||
|
|
||||||
CV_EXPORTS_W void shiftMat(InputArray src, Point shift, OutputArray dst);
|
CV_EXPORTS_W void shiftMat(InputArray src, Point shift, OutputArray dst);
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ static Mat linearResponse()
|
|||||||
{
|
{
|
||||||
Mat response(256, 1, CV_32F);
|
Mat response(256, 1, CV_32F);
|
||||||
for(int i = 1; i < 256; i++) {
|
for(int i = 1; i < 256; i++) {
|
||||||
response.at<float>(i) = log((float)i);
|
response.at<float>(i) = logf((float)i);
|
||||||
}
|
}
|
||||||
response.at<float>(0) = response.at<float>(1);
|
response.at<float>(0) = response.at<float>(1);
|
||||||
return response;
|
return response;
|
||||||
@ -84,7 +84,7 @@ static void modifyCheckResponse(Mat &response)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void checkImages(std::vector<Mat>& images, bool hdr, const std::vector<float>& _exp_times = std::vector<float>())
|
static void checkImages(const std::vector<Mat>& images, bool hdr, const std::vector<float>& _exp_times = std::vector<float>())
|
||||||
{
|
{
|
||||||
CV_Assert(!images.empty());
|
CV_Assert(!images.empty());
|
||||||
CV_Assert(!hdr || images.size() == _exp_times.size());
|
CV_Assert(!hdr || images.size() == _exp_times.size());
|
||||||
@ -132,7 +132,7 @@ void makeHDR(InputArrayOfArrays _images, const std::vector<float>& _exp_times, O
|
|||||||
|
|
||||||
std::vector<float> exp_times(_exp_times.size());
|
std::vector<float> exp_times(_exp_times.size());
|
||||||
for(size_t i = 0; i < exp_times.size(); i++) {
|
for(size_t i = 0; i < exp_times.size(); i++) {
|
||||||
exp_times[i] = log(_exp_times[i]);
|
exp_times[i] = logf(_exp_times[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
float weights[256];
|
float weights[256];
|
||||||
@ -190,7 +190,7 @@ void exposureFusion(InputArrayOfArrays _images, OutputArray _dst, float wc, floa
|
|||||||
pow(deviation, 2.0, deviation);
|
pow(deviation, 2.0, deviation);
|
||||||
saturation += deviation;
|
saturation += deviation;
|
||||||
}
|
}
|
||||||
sqrt(saturation, saturation);
|
sqrt(saturation, saturation);
|
||||||
|
|
||||||
wellexp = Mat::ones(gray.size(), CV_32FC1);
|
wellexp = Mat::ones(gray.size(), CV_32FC1);
|
||||||
for(int i = 0; i < 3; i++) {
|
for(int i = 0; i < 3; i++) {
|
||||||
@ -209,7 +209,7 @@ void exposureFusion(InputArrayOfArrays _images, OutputArray _dst, float wc, floa
|
|||||||
weights[im] = weights[im].mul(wellexp);
|
weights[im] = weights[im].mul(wellexp);
|
||||||
weight_sum += weights[im];
|
weight_sum += weights[im];
|
||||||
}
|
}
|
||||||
int maxlevel = (int)(log((double)max(images[0].rows, images[0].cols)) / log(2.0)) - 1;
|
int maxlevel = static_cast<int>(logf(static_cast<float>(max(images[0].rows, images[0].cols))) / logf(2.0)) - 1;
|
||||||
std::vector<Mat> res_pyr(maxlevel + 1);
|
std::vector<Mat> res_pyr(maxlevel + 1);
|
||||||
|
|
||||||
for(size_t im = 0; im < images.size(); im++) {
|
for(size_t im = 0; im < images.size(); im++) {
|
||||||
@ -291,4 +291,5 @@ void estimateResponse(InputArrayOfArrays _images, const std::vector<float>& exp_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
//
|
//
|
||||||
//M*/
|
//M*/
|
||||||
|
|
||||||
|
#include "precomp.hpp"
|
||||||
#include "opencv2/photo.hpp"
|
#include "opencv2/photo.hpp"
|
||||||
#include "opencv2/imgproc.hpp"
|
#include "opencv2/imgproc.hpp"
|
||||||
|
|
||||||
@ -52,8 +53,7 @@ static float getParam(const std::vector<float>& params, size_t i, float defval)
|
|||||||
return params[i];
|
return params[i];
|
||||||
} else {
|
} else {
|
||||||
return defval;
|
return defval;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DragoMap(Mat& src_img, Mat &dst_img, const std::vector<float>& params)
|
static void DragoMap(Mat& src_img, Mat &dst_img, const std::vector<float>& params)
|
||||||
@ -63,7 +63,7 @@ static void DragoMap(Mat& src_img, Mat &dst_img, const std::vector<float>& param
|
|||||||
cvtColor(src_img, gray_img, COLOR_RGB2GRAY);
|
cvtColor(src_img, gray_img, COLOR_RGB2GRAY);
|
||||||
Mat log_img;
|
Mat log_img;
|
||||||
log(gray_img, log_img);
|
log(gray_img, log_img);
|
||||||
float mean = exp((float)sum(log_img)[0] / log_img.total());
|
float mean = expf(static_cast<float>(sum(log_img)[0]) / log_img.total());
|
||||||
gray_img /= mean;
|
gray_img /= mean;
|
||||||
log_img.release();
|
log_img.release();
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ static void DragoMap(Mat& src_img, Mat &dst_img, const std::vector<float>& param
|
|||||||
Mat map;
|
Mat map;
|
||||||
log(gray_img + 1.0f, map);
|
log(gray_img + 1.0f, map);
|
||||||
Mat div;
|
Mat div;
|
||||||
pow(gray_img / (float)max, log(bias_value) / log(0.5f), div);
|
pow(gray_img / (float)max, logf(bias_value) / logf(0.5f), div);
|
||||||
log(2.0f + 8.0f * div, div);
|
log(2.0f + 8.0f * div, div);
|
||||||
map = map.mul(1.0f / div);
|
map = map.mul(1.0f / div);
|
||||||
map = map.mul(1.0f / gray_img);
|
map = map.mul(1.0f / gray_img);
|
||||||
|
Loading…
Reference in New Issue
Block a user