Starting from:
$35

$29

Assignment 3: Tone Mapping Solution

1  Assignment description

Tone mapping is a technique used in image processing to map one set of colors to another to approximate the appearance of high-dynamic-range (HDR) images in a medium that has a more limited dynamic range. Tone mapping operators can be divided into two main types:

    • global operators: non-linear functions based on the luminance and other global variables of the image.
    • local operators: the parameters of the non-linear function change in each pixel, according to features extracted from the surrounding parameters.

In this assignment, you’ll need to implement these two types of tone mapping with 2 operators respectively: global logarithmic operator and Durand’s local operator.

2  Assignment details

2.1 Overview

Given the path of an HDR image, the tone mapping procedure can be described as follows:
procedure





_            ℎ,)



1.(




2.
Apply

_
            ℎ


_

3.
Apply



_
. [provided]


4.
Load



from

to 8-bit.





Convert the






_


.
5.
Save the

_
to



, get tone mapped




gamma correction to the result

. [provided]




_




[provided]


















. [provided]

2.2 ToneMap functions
The algorithm of a generic    can be described as follows:
procedure
[compute

Luminance




_



1.()





.



Compute the


of each pixel in the













Luminance   =

3.


luminance()]










( )

to  , compute the Display




2.
Apply


Luminace



_


[map_





_











. [tone mapping operators]





4.
Map Display


on the

to compose the

.

Return_.












luminance()]













We will discuss the implementation details in next several subsections.
2.3 Operators
We can use the following function to map the luminance  of the_to display luminance  :
2.3.1

Logarithmic operator



log(  +  ) − log (+  )

















where


and


are the minimum
log(
+  ) − log (

+  )



.





=





=(−)

≥ 0










and maximum luminance of the scene,

,


This equation ensures that the maximum and minimum luminance values of the scene are

image. In this


[0,1]










respectively mapped to the maximum and minimum luminance of the display device. Here the range of
display luminance is



= 0.05









. Adjusting


will appropriately tune the overall brightness of the reproduced




assignment, we set




.







This part is related to the function log_tonemap().

2.3.2    Durand’s operator

Beside the above two global tone mapping operators, you’ll need to implement a local tone mapping operator in this assignment. You’ll be implementing a simplified version of Durand’s operator. The steps are roughly as follows:

procedure






































1.(Luminace  )
log10( )










=





2. Filter that with a






















3.
Compute the log intensity


























_(log10( ))




































bilateral filter get the base layer:













log10



= log









Decompose the detail layer:























5.




=
max()−min()






1









6.
Compute the display







= 10















4.
Compute






















10( )










Reconstruct the luminance:







(  ×                                    +                                            )















=  ′ × 10max(  ×)



















luminance:





































































The



is a user-controllable parameter. We set


= 50
.



where
















above part is related to the function durand_tonemap().










Since the base layer is computed by the bilateral filter, you may need to implement the filter:








filtered( ) =


1



( ,  ;
)(()
−(); )()










( )
() ∈Ω






; ) (()−();  )














=

�  ( ,




pixel


is the filtered image;

∈Ω


























is the original input image;

are the coordinates of the current
where









(spatial kernel) for
Ω

;












∈ Ω












to be filtered;

is the window centered in



, so



is another pixel;   is the 2D Gaussian kernel
min(_                ℎ,_ℎ            ℎ    )
































smoothing differences in coordinates, here we choose









= 2 × max(



= 0.4









kernel) for smoothing
computed as






.


















(1.5  ), 1)


+ 1












differences in intensities, here we choose







. The spatial kernel size (or the window size) can be

The above part is relate to bilateral_filter(). You are allowed to use a bilateral filter from some third-party libraries. In that case, you can just put your function invocation inside the function body of bilateral_filter(). If you choose to implement the bilateral filter by yourself, you will get some extra bonus points.
2.4
Mapping Luminance

_





_

Conventionally, we can scale the RGB values of

by


to get the



:
Since the desired result is an RGB image, we need to map the display luminance

to the color space.






×








    ℎ                    
=     ℎ                    






where

is the luminance of the
_
. This part is related to
the function map_luminance().











2.5 Summary

In this assignment, you are required to implement tone mapping in Python 3.4+. In order to make the skeleton code functional, you need to complete these four functions in the skeleton code:
map_luminance(), bilateral_filter(), log_tonemap(),durand_tonemap().

The skeleton code depends on OpenCV and Numpy. You are allowed to import third-party libraries into the code. However, you are not allowed to directly use tone mapping operator from these libraries.

Moreover, you can find some HDR images in the test_images directory. Tone mapped images will be generated in the output directory.

3  Submission guidelines

You need to submit the completed tone_mapping.py to the Blackboard.

3.1 Marks

    • map_luminance():10 points
•    log_tonemap():    30 points

    • durand_tonemap():60 points

    • bilateral_filter(): extra 20 bonus points if you implement this filter by yourself (with pure Python and Numpy)

3.2 Put personal information in your source code

In your source code file, type your full name and student ID, just like:

#
    • CSCI3290 Computational Imaging and Vision *
    • --- Declaration --- *

    • I declare that the assignment here submitted is original except for source

    • material explicitly acknowledged. I also acknowledge that I am aware of

    • University policy and regulations on honesty in academic work, and of the

    • disciplinary guidelines and procedures applicable to breaches of such policy
    • and regulations, as contained in the website

    • http://www.cuhk.edu.hk/policy/academichonesty/ *

    • Assignment 3

    • Name:

    • Student ID:
    • Email Addr:
#

3.3 Late submission penalty

If you submit your solution after the due date, 10 marks will be deducted per day, and the maximal deduction is 30 marks even you delay more than 3 days. But there are hard deadlines as we need time to grade and submit grade. The hard deadline is 29 April 2020. After this day, we will not grade your assignment.

More products