Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Diff of /banding.htm [82647c] .. [8a5fe8] Maximize Restore

  Switch to side-by-side view

--- a/banding.htm
+++ b/banding.htm
@@ -1,13 +1,13 @@
 <h1>Banding Artifacts</h1>
 <p class="author">By Andrew Mihal, 18 September 2004</p>
-<p>With Enblend versions 1.3 and earlier, users reported seeing unusual 
-artifacts in the skies of some images. In this article, I discuss the cause and 
+<p>With Enblend versions 1.3 and earlier, users reported seeing unusual
+artifacts in the skies of some images. In this article, I discuss the cause and
 solution of these artifacts.</p>
-<p>Here is an example of an image with banding. The version on the left is the 
-unmodified Enblend v1.3 output. The version on the right has been adjusted in 
-brightness and contrast to make the bands more visible. If you have a good eye, 
-you can see the bands in the original. It may help to smoothly scroll the page 
-up and down. It has been reported that the bands are more visible in printed 
+<p>Here is an example of an image with banding. The version on the left is the
+unmodified Enblend v1.3 output. The version on the right has been adjusted in
+brightness and contrast to make the bands more visible. If you have a good eye,
+you can see the bands in the original. It may help to smoothly scroll the page
+up and down. It has been reported that the bands are more visible in printed
 images.</p>
 <div class="illustration">
 <div class="image">
@@ -19,16 +19,16 @@
 <p>Contrast/Brightness Enhanced</p>
 </div>
 </div>
-<p>In this project, there are two input images side-by-side. The 
-seam runs vertically through the center of the image. The overlap region starts 
+<p>In this project, there are two input images side-by-side. The
+seam runs vertically through the center of the image. The overlap region starts
 at 1/4 of the way across the image and ends at 3/4 of the way across the image.</p>
-<p>My initial hypothesis was that numerical precision alone was at 
-fault. In Enblend versions 1.3 and earlier, integer arithmetic is used to store 
-intermediate calculations. Over the course of a blending iteration, rounding 
-errors gradually accumulate and can lead to artifacts. To test this theory I 
-modified the blending algorithm to use fixed-point arithmetic to store 
-intermediate results. This gives higher accuracy without requiring more memory 
-than what was necessary before. The next three figures show the enhanced output 
+<p>My initial hypothesis was that numerical precision alone was at
+fault. In Enblend versions 1.3 and earlier, integer arithmetic is used to store
+intermediate calculations. Over the course of a blending iteration, rounding
+errors gradually accumulate and can lead to artifacts. To test this theory I
+modified the blending algorithm to use fixed-point arithmetic to store
+intermediate results. This gives higher accuracy without requiring more memory
+than what was necessary before. The next three figures show the enhanced output
 of 1.3, the enhanced output with fixed-point math, and the difference image.</p>
 <div class="illustration">
 <div class="image">
@@ -44,39 +44,39 @@
 <p>Difference</p>
 </div>
 </div>
-<p>According to the difference image, the bands can be explained by 
-rounding errors, especially in the green channel. The magnitude of these errors 
-is surprising. The brightest spots in the difference image correspond to a 
-difference of only 2 pixel values! The integer approximation was not really that 
-bad. I believe the only reason you can see these errors is because the human eye 
-is more sensitive to green than red or blue. Secondly, the errors occur in 
-groups with clearly defined boundaries that give the eye something to latch on 
+<p>According to the difference image, the bands can be explained by
+rounding errors, especially in the green channel. The magnitude of these errors
+is surprising. The brightest spots in the difference image correspond to a
+difference of only 2 pixel values! The integer approximation was not really that
+bad. I believe the only reason you can see these errors is because the human eye
+is more sensitive to green than red or blue. Secondly, the errors occur in
+groups with clearly defined boundaries that give the eye something to latch on
 to.</p>
-<p>Unfortunately, numerical precision is only part of the problem. 
-There is still a visible artifact in the middle image above. There is a vertical 
-line that starts at the top middle, goes straight down to the image center, and 
+<p>Unfortunately, numerical precision is only part of the problem.
+There is still a visible artifact in the middle image above. There is a vertical
+line that starts at the top middle, goes straight down to the image center, and
 then heads in a 5 o'clock direction to the bottom.</p>
-<p>As it turns out, the average color of the sky in each input 
-image is nearly identical. I measured the average value of the green channel on 
-either side of the seam in the middle image and found that it differed by only 1 
-color value! Since the sky has the lowest spatial frequency, Enblend tries to 
-blend this small color difference over as wide a region as possible. However, 
-with only 256 possible color values for each channel, there are simply not 
-enough colors available to smooth out the differences gradually. There cannot be 
-a gradient here. At the seam, the green channel is going to switch from N to 
+<p>As it turns out, the average color of the sky in each input
+image is nearly identical. I measured the average value of the green channel on
+either side of the seam in the middle image and found that it differed by only 1
+color value! Since the sky has the lowest spatial frequency, Enblend tries to
+blend this small color difference over as wide a region as possible. However,
+with only 256 possible color values for each channel, there are simply not
+enough colors available to smooth out the differences gradually. There cannot be
+a gradient here. At the seam, the green channel is going to switch from N to
 N+1. That is what we are seeing in the middle image.</p>
-<p>In Enblend version 1.3 and earlier, integer arithmetic rounding 
-errors caused this step change to occur at unpredictable locations. Hence the 
-banding artifacts. With fixed-point arithmetic, the step change happens exactly 
+<p>In Enblend version 1.3 and earlier, integer arithmetic rounding
+errors caused this step change to occur at unpredictable locations. Hence the
+banding artifacts. With fixed-point arithmetic, the step change happens exactly
 at the seam line.</p>
-<p>There are two ways to solve this problem. First, you can use a 
-16-bit workflow. With 16 bits/channel there are enough colors available to make 
-a gradual change between very closely matched colors. While the eye can see a 
-color difference of 1 part in 256 on a computer monitor, we cannot see a 
+<p>There are two ways to solve this problem. First, you can use a
+16-bit workflow. With 16 bits/channel there are enough colors available to make
+a gradual change between very closely matched colors. While the eye can see a
+color difference of 1 part in 256 on a computer monitor, we cannot see a
 difference of 1 part in 65536.</p>
-<p>Alternatively, one can use dithering to trick the eye into 
-seeing a gradient even when there are only two colors, for example in the switch 
-between green N and green N+1. I implemented this for blending 8-bit images. The 
+<p>Alternatively, one can use dithering to trick the eye into
+seeing a gradient even when there are only two colors, for example in the switch
+between green N and green N+1. I implemented this for blending 8-bit images. The
 results are shown below.</p>
 <div class="illustration">
 <div class="image">
@@ -92,11 +92,11 @@
 <p>Difference (green channel only)</p>
 </div>
 </div>
-<p>The dithering introduces some randomness when fixed-point values 
-are quantized back into 8-bit color values. This prevents the sudden step in 
-color at the seam line. The transition is still there, but it no longer has a 
-definite edge that the eye can pick out. In the difference image above only the 
-green channel is shown, and each dot represents a difference of only one color 
+<p>The dithering introduces some randomness when fixed-point values
+are quantized back into 8-bit color values. This prevents the sudden step in
+color at the seam line. The transition is still there, but it no longer has a
+definite edge that the eye can pick out. In the difference image above only the
+green channel is shown, and each dot represents a difference of only one color
 value. The final image without brightness and contrast correction is show below.</p>
 <div class="illustration">
 <div class="image">
@@ -104,12 +104,12 @@
 <p>Final Image Using Fixed-Point and Dithering</p>
 </div>
 </div>
-<p>In summary, it is a combination of numerical precision errors 
-and limitations of an 8 bit/channel color format that is the cause of the 
-banding artifacts. Rounding errors were responsible for the shape of the bands, 
-but this was just hiding the underlying issue that 256 levels of green is not 
+<p>In summary, it is a combination of numerical precision errors
+and limitations of an 8 bit/channel color format that is the cause of the
+banding artifacts. Rounding errors were responsible for the shape of the bands,
+but this was just hiding the underlying issue that 256 levels of green is not
 enough for quality digital imaging.</p>
 <h3>Acknowledgements</h3>
-<p>Thanks to John Houghton for providing the Tower Bridge images I 
+<p>Thanks to John Houghton for providing the Tower Bridge images I
 used as examples.</p>