Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Adjust image intensity & apply blue tint to an image

$
0
0
Hello,

I have to adjust image intensity and then apply blue tint to an image using below mentioned algorithm written in “Interactive Data Language” (IDL).

Most commonly, photographs are three channel images with a red, a green and a blue image (RGB). Usually the data is stored as “sRGB”, which means there is a non-linear encoding of the amount of light a pixel represents to a pixel value that maps to the display device.

Blue Channel
The simplest form of “blue light simulation” is simply using the blue channel by itself. It has the strongest contrast between spots and background skin. However, the image is much darker and needs lighting up. In the real world, we would increase the number of photons on each pixel, by increasing the strength of the lighting, opening up the aperture of the camera or using a longer shutter time. To simulate this with an existing RGB image, first the sRGB encoding needs to be removed. The simplest way of approximating this is by using this:
Bg = (B/255)γ, where we use γ = 2.2
B is the original pixel value, Bg is “gamma corrected” or linearized pixel value. These latter values can now be multiplied, gamma-transformed and put back into the image.
Enhanced-B = 255 * (factor * Bg)1/γ   
Where factor can be set to the increase in light intensity. Note that values need to be clipped at a value of 255 (pixels greater than 255 are set to 255). The figure below illustrates factor =2 and factor = 4:

It can be seen that simulating 4x as much light looks much like doubling the pixel values without linearizing the blue channel. However, doubling the pixel values increases the perceived lightness of the lighter areas more than that of the darker area, and hence enhances the contrast more than could be achieved with just photography.

The final step in the simulation is to present an image with a blue tint. This is simply accomplished by creating a three-channel image with the Bg values in each channel, adjusting each of the channels with a constant representing a blue tint, and transforming that back to an sRGB image:
Enhanced-Red = 255 * (factor * ( RedC + Bg) )1/γ   
And analogously for Green and Blue. A good tint vector is [RedC, GreenC, BlueC] = [-0.03,-0.03,0.03].

Please suggest how we can achieve same using Magick.Net API.

Thanks in advance!!

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>