mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 11:10:21 +08:00
Documentation
This commit is contained in:
parent
a29ce401d5
commit
ec668ce3a7
@ -1,42 +0,0 @@
|
||||
\ProvidesPackage{mymath}
|
||||
|
||||
\newcommand{\matTT}[9]{
|
||||
\[
|
||||
\left|\begin{array}{ccc}
|
||||
#1 & #2 & #3\\
|
||||
#4 & #5 & #6\\
|
||||
#7 & #8 & #9
|
||||
\end{array}\right|
|
||||
\]
|
||||
}
|
||||
|
||||
\newcommand{\fork}[4]{
|
||||
\left\{
|
||||
\begin{array}{l l}
|
||||
#1 & \mbox{#2}\\
|
||||
#3 & \mbox{#4}\\
|
||||
\end{array} \right.}
|
||||
\newcommand{\forkthree}[6]{
|
||||
\left\{
|
||||
\begin{array}{l l}
|
||||
#1 & \mbox{#2}\\
|
||||
#3 & \mbox{#4}\\
|
||||
#5 & \mbox{#6}\\
|
||||
\end{array} \right.}
|
||||
|
||||
\newcommand{\vecthree}[3]{
|
||||
\begin{bmatrix}
|
||||
#1\\
|
||||
#2\\
|
||||
#3
|
||||
\end{bmatrix}
|
||||
}
|
||||
|
||||
\newcommand{\vecthreethree}[9]{
|
||||
\begin{bmatrix}
|
||||
#1 & #2 & #3\\
|
||||
#4 & #5 & #6\\
|
||||
#7 & #8 & #9
|
||||
\end{bmatrix}
|
||||
}
|
||||
|
@ -78,17 +78,19 @@ bool HdrDecoder::readHeader()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HdrDecoder::readData(Mat& img)
|
||||
bool HdrDecoder::readData(Mat& _img)
|
||||
{
|
||||
Mat img(m_height, m_width, CV_32FC3);
|
||||
if(!file) {
|
||||
readHeader();
|
||||
}
|
||||
if(img.cols != m_width || img.rows != m_height ||
|
||||
img.type() != CV_32FC3) {
|
||||
CV_Error(Error::StsError, "HDR decoder: bad mat");
|
||||
}
|
||||
RGBE_ReadPixels_RLE(file, const_cast<float*>(img.ptr<float>()), img.cols, img.rows);
|
||||
fclose(file); file = NULL;
|
||||
if(_img.depth() == img.depth()) {
|
||||
img.convertTo(_img, _img.type());
|
||||
} else {
|
||||
img.convertTo(_img, _img.type(), 255);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -115,10 +117,13 @@ HdrEncoder::~HdrEncoder()
|
||||
{
|
||||
}
|
||||
|
||||
bool HdrEncoder::write( const Mat& img, const std::vector<int>& params )
|
||||
bool HdrEncoder::write( const Mat& _img, const std::vector<int>& params )
|
||||
{
|
||||
if(img.type() != CV_32FC3) {
|
||||
CV_Error(Error::StsBadArg, "HDR encoder: need 32FC3 mat");
|
||||
Mat img;
|
||||
if(_img.depth() == CV_32F) {
|
||||
_img.convertTo(img, CV_32FC3);
|
||||
} else {
|
||||
_img.convertTo(img, CV_32FC3, 1/255.0f);
|
||||
}
|
||||
if(!(params.empty() || params[0] == HDR_NONE || params[0] == HDR_RLE)) {
|
||||
CV_Error(Error::StsBadArg, "HDR encoder: wrong compression param");
|
||||
|
116
modules/photo/doc/hdr_imaging.rst
Normal file
116
modules/photo/doc/hdr_imaging.rst
Normal file
@ -0,0 +1,116 @@
|
||||
HDR imaging
|
||||
==========
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
makeHDR
|
||||
-----------
|
||||
Creates HDR image from a set of bracketed exposures using algorithm by Debevec and Malik.
|
||||
|
||||
"Recovering High Dynamic Range Radiance Maps from Photographs", Debevec, Malik, 1997
|
||||
|
||||
.. ocv:function:: void makeHDR(InputArrayOfArrays srcImgs, const std::vector<float>& expTimes, OutputArray dst, bool align = false)
|
||||
|
||||
:param src_imgs: vector of 8-bit 3-channel images
|
||||
|
||||
:param exp_times: exposure times for each of source images
|
||||
|
||||
:param dst: output image
|
||||
|
||||
:param align: if true, images are first aligned using median threshold bitmap algorithm. See :ocv:func:`getExpShift`.
|
||||
|
||||
tonemap
|
||||
-----------
|
||||
Tonemaps image.
|
||||
|
||||
.. ocv:function:: tonemap(InputArray src, OutputArray dst, int algorithm, const std::vector<float>& params = std::vector<float>())
|
||||
|
||||
:param src: input HDR image
|
||||
|
||||
:param dst: floating-point image in [0; 1] range
|
||||
|
||||
:param algorithm:
|
||||
* TONEMAP_LINEAR - simple linear mapping
|
||||
|
||||
* TONEMAP_DRAGO - "Adaptive Logarithmic Mapping For Displaying HighContrast Scenes", Drago et al., 2003
|
||||
|
||||
* TONEMAP_REINHARD - "Dynamic Range Reduction Inspired by Photoreceptor Physiology", Reinhard, Devlin, 2005
|
||||
|
||||
* TONEMAP_DURAND - "Fast Bilateral Filtering for the Display of High-Dynamic-Range Images", Durand, Dorsey, 2002
|
||||
|
||||
:param params: vector of parameters for specified algorithm.
|
||||
If some parameters are missing default values are used.
|
||||
The first element is gamma value for gamma correction.
|
||||
|
||||
* TONEMAP_LINEAR:
|
||||
|
||||
No parameters.
|
||||
|
||||
* TONEMAP_DRAGO:
|
||||
|
||||
params[1] - value for bias function. Range [0.7, 0.9], default 0.85.
|
||||
|
||||
* TONEMAP_REINHARD:
|
||||
|
||||
params[1] - result intensity. Range [-8, 8], default 0.
|
||||
|
||||
params[2] - chromatic adaptation. Range [0, 1], default 0.
|
||||
|
||||
params[3] - light adaptation. Range [0, 1], default 0;
|
||||
|
||||
* TONEMAP_DURAND:
|
||||
|
||||
params[1] - result contrast on logarithmic scale.
|
||||
|
||||
params[2] - bilateral filter sigma in the color space.
|
||||
|
||||
params[3] - bilateral filter sigma in the coordinate space.
|
||||
|
||||
exposureFusion
|
||||
-----------
|
||||
Fuses a bracketed exposure sequence into a single image without converting to HDR first.
|
||||
|
||||
"Exposure Fusion", Mertens et al., 2007
|
||||
|
||||
.. ocv:function:: exposureFusion(InputArrayOfArrays src_imgs, OutputArray dst, bool align = false, float wc = 1, float ws = 1, float we = 0)
|
||||
|
||||
:param src_imgs: vector of 8-bit 3-channel images
|
||||
|
||||
:param dst: output image. Although it's a floating-point image tonemapping is not necessary.
|
||||
|
||||
:param align: if true, images are first aligned using median threshold bitmap algorithm. See :ocv:func:`getExpShift`.
|
||||
|
||||
:param wc: contrast factor weight
|
||||
|
||||
:param ws: saturation factor weight
|
||||
|
||||
:param we: well-exposedness factor weight
|
||||
|
||||
getExpShift
|
||||
-----------
|
||||
Calculates translation vector that can be used to align img1 with img0.
|
||||
Uses median threshold bitmap algorithm by Ward.
|
||||
|
||||
"Fast, Robust Image Registration for Compositing High Dynamic Range Photographs from Handheld Exposures", Ward, 2003
|
||||
|
||||
.. ocv:function:: getExpShift(InputArray img0, InputArray img1, int max_bits = 6, int exclude_range = 4)
|
||||
|
||||
:param img0: 8-bit 1-channel image
|
||||
|
||||
:param img1: 8-bit 1-channel image
|
||||
|
||||
:param max_bits: logarithm to the base 2 of maximal shift in each dimension
|
||||
|
||||
:param exclude_range: range value for exclusion bitmap. Refer to the article.
|
||||
|
||||
shiftMat
|
||||
-----------
|
||||
Shifts image filling the new regions with zeros.
|
||||
|
||||
.. ocv:function:: shiftMat(InputArray src, Point shift, OutputArray dst)
|
||||
|
||||
:param src: input image
|
||||
|
||||
:param shift: shift vector
|
||||
|
||||
:param dst: output image
|
@ -9,3 +9,4 @@ photo. Computational Photography
|
||||
|
||||
inpainting
|
||||
denoising
|
||||
hdr_imaging
|
@ -102,9 +102,6 @@ static void computeBitmaps(Mat& img, Mat& tb, Mat& eb, int exclude_range)
|
||||
void shiftMat(InputArray _src, Point shift, OutputArray _dst)
|
||||
{
|
||||
Mat src = _src.getMat();
|
||||
if(src.depth() != CV_8U) {
|
||||
CV_Error(Error::StsBadArg, "Image must have CV_8U depth.");
|
||||
}
|
||||
_dst.create(src.size(), src.type());
|
||||
Mat dst = _dst.getMat();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user