2. System design - radhikahorti/Dynamic-Display-of-Histogram-and-Tone-curve GitHub Wiki
This chapter’s goal is to provide a detailed description of the process of solving the given problem statement using a functional block diagram and architecture. Implementation for three different tone-curves is also discussed.
2.1 Functional block diagram
ARGUS is an API for acquiring images and associated metadata from cameras. The fundamental ARGUS operation is capturing that is acquiring an image from a sensor and processing it into a final output image. Objects & Interfaces of ARGUS API used in this project: • iBayerHistogram(): Interface to Bayer histogram metadata • CaptureMetadata(): Container for metadata generated by a single completed capture • getToneMapCurve(): Returns the user-specified tone map curve for a channel on the stream • setToneMapCurve():sets the user-specified tone map curve for a channel on the stream
For input, first the frames are extracted from the live capture.After this the metadata for the current EGLStream frame is extracted using CaptureMetadata().From this metadata container, the Bayer histogram data is read via the interface iBayerHistogram().From the same container the default tone-curve can be read via the interface getToneMapCurve() by passing an empty vector through it.For setting the tone-curve, we first set the values using setToneMapCurve() and obtain the same using getToneMapCurve().Next we store the histogram data and tone-curve data of separate channels in separate arrays.To finally display these values we push these arrays into the histogram and tone-curve texture respectively. To scale the graphs, we obtain the maximum values of these arrays and generate the preview.
Figure 2.1: Functional block diagram for display of histogram and tone curve
2.2 Implementation of Tone Curves
Tone mapping operators or tone curve are basically functions that take the luminance of the pixel as the input and the output is a value that lies between 0 and 1 and produce an image that similar to what the human eye sees. There are many tone curve present and all of these curves have three components: • Shoulder: which is used to map the larger luminance values (highlights) and scale them to one (convergence is largely asymptotic). • Foot: Which is used to map the lower range of luminance values (shadows). This is not necessarily required but can help the image from being too dark. • Linear portion: which is to map the mid-tones.
The current project implements six tone curves: • Linear Tone Curve-> In this, the high dynamic range values are mapped to the lower dynamic range linearly and the overall contrast of the image is found to decrease. Contrast can be defined as the difference between the brightest tone and the darkest tone. Hence we infer that the overall brightness of the image decreases. Simple the function is applied globally to all the pixels it is expected to be computationally efficient. So, overall we can say that the image loses its detail. • Non-Linear Tone Curve-> The value for this tone curve were first generated manually and then the array of these values were passed through the interface setToneMapCurve() and the corresponding change in the tone-mapped image was observed.In this case also, the overall brightness of the image was lowered. • Reinhard Tone Curve -> The value for this tone curve were first generated manually and then the array of these values were passed through the interface setToneMapCurve() and the corresponding change in the tone-mapped image was observed.In this case also, the overall brightness of the image was found to be the same.
We have also implemented three additional curves namely exponential increase, S shaped and delayed S shaped tone curve. These curves increased the brightness of the given frame and decreased its contrast.
2.3 Final design
We have chosen to implement to implement global tone-mapping operators as they were found to be computationally efficient as it involves passing all the pixels through the same operation regardless of their spatial position. The current project aims at providing a recorded video stream for the given indoor/outdoor HDR scene with the histogram and tone-curve on preview. Also our proposed framework is attractive to the user as there are various tone curve operations being provided and the user is able to choose the appropriate tone curve as per the requirement present.