Doxygen tutorials: cpp done

This commit is contained in:
Maksim Shabunin
2014-11-28 16:21:28 +03:00
parent c5536534d8
commit 36a04ef8de
92 changed files with 2142 additions and 3691 deletions

View File

@@ -26,40 +26,43 @@ be implemented using different algorithms so take a look at the reference manual
Exposure sequence
-----------------
![image](images/memorial.png)
![](images/memorial.png)
### Source Code
Source Code
-----------
@includelineno cpp/tutorial_code/photo/hdr_imaging/hdr_imaging.cpp
### Explanation
Explanation
-----------
1. **Load images and exposure times**
@code{.cpp}
vector<Mat> images;
vector<float> times;
loadExposureSeq(argv[1], images, times);
@endcode
Firstly we load input images and exposure times from user-defined folder. The folder should
contain images and *list.txt* - file that contains file names and inverse exposure times.
-# **Load images and exposure times**
@code{.cpp}
vector<Mat> images;
vector<float> times;
loadExposureSeq(argv[1], images, times);
@endcode
Firstly we load input images and exposure times from user-defined folder. The folder should
contain images and *list.txt* - file that contains file names and inverse exposure times.
For our image sequence the list is following:
@code{.none}
memorial00.png 0.03125
memorial01.png 0.0625
...
memorial15.png 1024
@endcode
2. **Estimate camera response**
@code{.cpp}
Mat response;
Ptr<CalibrateDebevec> calibrate = createCalibrateDebevec();
calibrate->process(images, response, times);
@endcode
It is necessary to know camera response function (CRF) for a lot of HDR construction algorithms.
We use one of the calibration algorithms to estimate inverse CRF for all 256 pixel values.
For our image sequence the list is following:
@code{.none}
memorial00.png 0.03125
memorial01.png 0.0625
...
memorial15.png 1024
@endcode
3. **Make HDR image**
-# **Estimate camera response**
@code{.cpp}
Mat response;
Ptr<CalibrateDebevec> calibrate = createCalibrateDebevec();
calibrate->process(images, response, times);
@endcode
It is necessary to know camera response function (CRF) for a lot of HDR construction algorithms.
We use one of the calibration algorithms to estimate inverse CRF for all 256 pixel values.
-# **Make HDR image**
@code{.cpp}
Mat hdr;
Ptr<MergeDebevec> merge_debevec = createMergeDebevec();
@@ -68,45 +71,43 @@ merge_debevec->process(images, hdr, times, response);
We use Debevec's weighting scheme to construct HDR image using response calculated in the previous
item.
4. **Tonemap HDR image**
@code{.cpp}
Mat ldr;
Ptr<TonemapDurand> tonemap = createTonemapDurand(2.2f);
tonemap->process(hdr, ldr);
@endcode
Since we want to see our results on common LDR display we have to map our HDR image to 8-bit range
preserving most details. It is the main goal of tonemapping methods. We use tonemapper with
bilateral filtering and set 2.2 as the value for gamma correction.
-# **Tonemap HDR image**
@code{.cpp}
Mat ldr;
Ptr<TonemapDurand> tonemap = createTonemapDurand(2.2f);
tonemap->process(hdr, ldr);
@endcode
Since we want to see our results on common LDR display we have to map our HDR image to 8-bit range
preserving most details. It is the main goal of tonemapping methods. We use tonemapper with
bilateral filtering and set 2.2 as the value for gamma correction.
5. **Perform exposure fusion**
@code{.cpp}
Mat fusion;
Ptr<MergeMertens> merge_mertens = createMergeMertens();
merge_mertens->process(images, fusion);
@endcode
There is an alternative way to merge our exposures in case when we don't need HDR image. This
process is called exposure fusion and produces LDR image that doesn't require gamma correction. It
also doesn't use exposure values of the photographs.
-# **Perform exposure fusion**
@code{.cpp}
Mat fusion;
Ptr<MergeMertens> merge_mertens = createMergeMertens();
merge_mertens->process(images, fusion);
@endcode
There is an alternative way to merge our exposures in case when we don't need HDR image. This
process is called exposure fusion and produces LDR image that doesn't require gamma correction. It
also doesn't use exposure values of the photographs.
6. **Write results**
@code{.cpp}
imwrite("fusion.png", fusion * 255);
imwrite("ldr.png", ldr * 255);
imwrite("hdr.hdr", hdr);
@endcode
Now it's time to look at the results. Note that HDR image can't be stored in one of common image
formats, so we save it to Radiance image (.hdr). Also all HDR imaging functions return results in
[0, 1] range so we should multiply result by 255.
-# **Write results**
@code{.cpp}
imwrite("fusion.png", fusion * 255);
imwrite("ldr.png", ldr * 255);
imwrite("hdr.hdr", hdr);
@endcode
Now it's time to look at the results. Note that HDR image can't be stored in one of common image
formats, so we save it to Radiance image (.hdr). Also all HDR imaging functions return results in
[0, 1] range so we should multiply result by 255.
### Results
Results
-------
Tonemapped image
----------------
### Tonemapped image
![image](images/ldr.png)
![](images/ldr.png)
Exposure fusion
---------------
![image](images/fusion.png)
### Exposure fusion
![](images/fusion.png)