Upload
sharib
View
327
Download
7
Embed Size (px)
Citation preview
A REPORT ON COLOR IMAGING
TECHNIQUES USED ON SOME NON-
CANONICAL IMAGES
LAB 2
[COLOR AND MULTISPECTRAL IMAGING…] The objective of this lab was to study and understand the efficiency of some of the color consistency algorithms.
Report Prepared By-Sharib ALI
Submitted to: Prof. Alamin MANSOURI
Abstract: Different images with different illuminace were provided and asked to apply some useful
algorithms to get the better quality of images. Some algorithms were better in some while
the other were better in the other. Like for example when we took Grey World for some
darker images we got good contrast image but the effect could hardly be distinguisible in
the images which were fairly bright.
The abstract of my work is that i tried to achieve the best quality image under different
algorithms and justify my results with the observations and MSE calculations. However,
time calculations were also one of the key element to judge the efficiency of the algorithms
I have used.
Color Consistency: The digital camera records large shifts in image colors under the different illuminations.
However, a human observer viewing each scene will be able to discount the color of the
illumination and perceive the colors in each scene as the same. This property of
compensating for illumination is called color constancy.
Illumination is rarely constant in intensity or color throughout a scene. Multiple light
sources with difference spectra. Almost all the color consistency algorithms assumes that
the spectrum of the spectrum of the incident illumination remains constant across the
scene.
1. GrayWorld
The grey world algorithm assumes that the average of all colors in an image is grey,
i.e. the red, green and blue components of the average color are equal. The amount
the image average departs from grey determines the illuminant RGB. This
assumption is held very well: in real world image, it is usually true that there are a
lot of different color variations. The variations in color are random and
independent; the average would converge to the mean value gray given an amount
of samples. Color balancing algorithms can apply this assumption by forcing its
images to have a common average gray value for its R,G and B components. In case
the image is taken by the digital camera under a particular lighting environment, the
effect of the special lighting cast can be removed by enforcing the gray world
assumption on the image. As a result the approximation, the color of the image is
much closer to the original scene.
Algorithm:
We find the mean of RGB channel
We find the mean value of each channel R, G and B
Kr=avg/R;Kg=avg/G;Kb=avg/B
Finally we get the new channels as:
B
G
R
K
K
K
B
G
R
B
G
R
c
c
00
00
00
Where, K values represents the coefficients of reflectance
2. White Patch
The white patch algorithm presumes that in every image there will be some surface
or surfaces such that there will be a point or points of maximal reflectance for each
of the R, G, and B bands. This algorithm realizes on having a bright patch at
somewhere in the image. The idea is that, this patch reflects the maximum intensity
of light possible for each band. Assuming that we are dealing with the approximate
Lambertian reflection, this will be the color of the illuminant. Once a bright patch
has been located, its color value can be used for an estimate of the white point.
Algorithm:
We find the maximum values for each channel in RGB space
We take the S(surface reflectance) to be 255
Using formula- Kr=S/Rmax and similarly for Kg and Kb
We finally apply the matrix above to get the new values for R,G and B
3. Modified White Patch Algorithm The white patch algorithm does not work when there is presence of noise or when
the maximum values equals to 255 in the image as it would make no change to the
calculated coefficients.
So, we apply the threshold to the RGB space and estimate the illumination from
bright zones that having the mean value. The color bands are re-scaled using this
white point estimation.
Algorithm
We take the mean of each channel
We take the maximum value of each channel and compare it with the
threshold.
If its true then we apply the illuminant coefficient to that channel in
particular
If the condition is false we don’t do any thing to that channel
4. Progressive Combination of gray World and Modified White Patch As the name implies progressive combination, it combines GW and MWP to give
better quality images. It trades of between all the ranges of the image. For the pixel
values below a threshold h1 (say) corresponds to the GW and the pixel values of the
image above certain threshold say h2 corresponds to the MWP. So, we apply GW
algorithm and MWP algorithms to certain pixel values. The pixels between them are
also updated with some reflectance coefficients which is given by some empirical
formula given below.
Step I.
Find the Average intensity ‘I’.
3
BGRI
Step II.
Comparing the average intensity with the thresholds (h2=20 threshold for GW and
h1=120(MWP)
Case 1: I<=h2
We do the calculations for the Gray world as shown in the algorithm above in GW
part.
Case 2: I>=h1
We do the calculations for the MWP as shown in the algorithm of MWP
Case 3: in between
21
2
21
1
hh
h
hhI
Calculate the value of k for each channel with the formula below. Apply reflectance
coefficients for the GW and MWP with certain factors as given below:
MWPGWk )1(
5. Retinex The main idea of Retinex was conceived by Edwin Land as a model of the lightness and color perception of human vision. The Retinex is a general purpose image enhancement algorithm that is used to improve the contrast, brightness and perceived sharpness of images primarily through dynamic range compression. It synthesizes contrast enhancement and color constancy by performing a non-linear spatial/spectral transform that mimics traits seen in the human vision system.
SSR
Algorithm for Single Scale Retinex
We take a Gaussian mask, given the value of ‘c’, standard deviation of the same size as that of the image to be reconstructed
We take the convolution between this mask and the original image
Io= yxIyxF i ,),(
Finally, we take the logarithmic difference between the original image and the convoluted output
SSR= log[),(log yxI i yxIyxF i ,),( ]
MSR-CC
The real need for MSRCC is to get the good image with the combined SSR images
obtained with different Gaussian masks having different values of c (we have taken
50,70,25 ,100) with different weights.
Algorithm for MSR-CC (Multiscale Retinex with Color Correction)
1. Calculate the SSR for different values of c
2. Sum all the results by giving some weight to each of your result
3. Finally, for the color correction
1
),(log),(log),(i
iii yxIyxIyxC where, is a critical parameter to
tune manually
4. We can multiply the final result with certain gain G and offset to improve our
result.
ACE (Automatic Color Correction)
ACE aims to model a simplified version of the inner complex behavior of the human visual system. It has been devised primarily for the enhancement of digital images, characterized by a lower dynamic range compared to the high range of real world scenes. To differentiate the real process from its model, we use the word adaptation to indicate the biological adaptations made by the human visual system in the real world and the word adjustment to indicate the simplified adaptations of ACE in the digital images domain. Algorithm
1. Chromatic Spatial Adjustment: It is done for the color constancy and contrast tuning. A spatial Comparison is done weighted by pixel distance
),(
)()()(,
jpdjIpIrpR
pjimgj
cc
2. Linear adjustment of the intensity of the output Rc is done within the interval (o, 255). It configures the output range to implement an accurate tone mapping, performing lightness constancy.
Fig. Showing different algorithms applied
PARAMETERS Used (in Above Image Algorithms)
Progressive Combination
h1=120 MWP h2=20 GW
Single Scale Retinex for C=5
Multiscale Retinex With Color Correction (MSRCC)
c w 25 0.1 35 0.25
alpha=60 45 0.5 offset=0, gain=1 100 0.7
Automatic Color Equalization(ACE)
r(.)=75
slope=255-0/max-min
CALCULATING MSE (Mean Square Error) and delE (Euclidean distance)
Mean Square Error
MSE
nm
IrIm
x
n
y
yxyxo
1 1
2
),(),(
Computing MSE globally
We take the original input image taken under canonical illumination and the result
of output image constructed applying different color consistency algorithms. We calculate
the MSE as given in the formula above. The significance of this error will give the
approximation of the nearness of the output image (taken under non-canonical) using a
certain algorithm and hence gives us the clear idea about its efficiency.
Computing MSE Locally
We define certain Region of interest in our image and take that as the mask to
compute the MSE. The ROI could be the over an area or an edge.
MATLAB: function roipoly (it generates a mask around the image). We have created a
function ROI which will take the mask over the image the user wants to. So, both for over
an area containing an edge and within a uniform area were done .
Euclidean Distance The Euclidean distance between the pixel values is calculated to see the convergence of the
images we get with the different methods of algorithm applied to the original image. First
the images are taken to LAB color space using MATLAB commands like srgb2lab ,
MEASUREMENTS
fish.tif (350x256) MSE GLOBAL MSE LOCAL delE GLOBAL delE LOCAL
Algorithm Time R G B R G B R G B R G B
GW 0.97841 1867.47 3634.09 3758.82 855.25 1659.2 1829.8 605.49 796.9 1652 30.62 175.9 900.3
WP 0.08108 2003.14 259.145 1303.83 915.1 77.048 635.31 605.49 796.9 1652 30.62 175.9 900.3
MWP 0.05043 8399.57 14879.8 8584.95 3394.6 5772.1 3737.6 605.49 796.9 1652 30.62 175.9 900.3
Prog. 0.23951 510.187 6669.22 2658.18 137.58 2824.8 1065.9 605.49 796.9 1652 30.62 175.9 900.3
SSR 12.0831 17588.1 21810.1 21847.2 7745.5 9923.3 10384 6368.3 2957.3 2118 3595 1762 1611
MSRCC 400.987 16284.9 20355.7 21859.7 7373.6 9497.2 10385 8339.3 8781.3 6629 4255 6649 4831
AEC 3709.29 1487.6 1936.72 1352.79 557.23 734.18 542.36 723.48 1411.6 2102 30.64 176.5 942.2
Building.jpg (350x256) MSE GLOBAL MSE LOCAL delE GLOBAL delE LOCAL
Algorithm Time R G B R G B R G B R G B
GW 0.53429 9713.27 10423.2 10012.1 5243.3 5312.3 4852.9 340.99 1839.5 956.1 137.9 645.6 705.4
WP 0.07985 257.42 128.244 102.025 132.69 61.655 42.591 261.21 1386.4 985.2 137.9 540.5 762.3
MWP 0.04496 9178.24 6727.4 8578.76 5022.9 3220.7 3866.2 261.21 1386.4 985.2 137.9 540.5 762.3
Progressive 0.189 6316.24 7919 7446.74 3408 4033.3 3604.5 275.14 1481.8 974.5 137.8 660 757
SSR 3.24469 16396.4 17072.6 16515.4 8855.6 8713.4 8020.6 7011.7 3131.8 3394 4608 1808 2001
MSRCC 235.161 15065.4 15711 16533.3 8304.4 8223.8 8026.4 10140 10760 8620 7627 8674 7157
AEC 1200.32 376.28 361.88 458.57
350.4 209.9 115.4 450 345 223 2234 2334 1234
table.png(350x256) MSE GLOBAL MSE LOCAL delE GLOBAL delE LOCAL
Algorithm Time R G B R G B R G B R G B
GW 0.53429 9713.27 10423.2 10012.1 5243.3 5312.3 4852.9 340.99 1839.5 956.1 137.9 645.6 705.4
WP 0.07985 257.42 128.244 102.025 132.69 61.655 42.591 261.21 1386.4 985.2 137.9 540.5 762.3
MWP 0.04496 9178.24 6727.4 8578.76 5022.9 3220.7 3866.2 261.21 1386.4 985.2 137.9 540.5 762.3
PROG 0.189 6316.24 7919 7446.74 3408 4033.3 3604.5 275.14 1481.8 974.5 137.8 660 757
SSR 3.24469 16396.4 17072.6 16515.4 8855.6 8713.4 8020.6 7011.7 3131.8 3394 4608 1808 2001
MSRCC 235.161 15065.4 15711 16533.3 8304.4 8223.8 8026.4 10140 10760 8620 7627 8674 7157
Some Key Observations: 1. Gray World showed some good result with almost all the images.
2. White Patch did not show better result than the Gray world. The MSE eror of White
patch therefore is seen to be more than the GW in the darker images.
3. Modified White Patch has relatively more MSE and del E. So, it is also not a good
algorithm when there is less noise.
4. Progressive also gave good results for some brighter images. Its better than the
MWP.
5. SSR gave good results with higher values of standard deviation ‘c’.
6. MSRRCC was nearly very good but still there has to be lot to be done with the
contrast and the brightness. However, in context of color it gave some good result.
From the chart it can be seen that MSE is relatively low for MSRCC than SSR
7. One of the main effects of an equalization algorithm(ACE) is the image’s mean
lightness adjustment. Retinex, like most of the color correction algorithms that
search for the white, tends to increase the overall lightness of the image if its mean
lightness is below the medium gray, but does not change it significantly if its mean is
over the medium value. On the contrary, ACE, due to its gray world behavior
component, is able to modify the image’s mean lightness in both directions,
according to its original value. This difference has been eliminated.
8. AEC gives best results for the darker images and fairly good with the brighter
images as it combines both GW and WP for the scaling reference.
Fig. Automatic Color Equalization Underwater
(original image under non-canonical illuminant is undergone ACE)
Fig . Results of some other Algorithms applied to Non-Cannonical Image
Fig. Showing Different Algorithms applied to the Original (non-canonical)
image