Fractals/Image noise

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Image noise [1]

  • set of all pixels which are not rendered properly
  • "aberrant pixels. That means pixels that are not representing the colour ... correctly. " Barry J Brady[2]

Noise can be in different situations. Here only noise in the rendered images is incuded. So there is no original image[3], no photo, no signal, ...

key words[edit | edit source]

  • pixel spacing


types[edit | edit source]

Moire patterns[edit | edit source]

"A uniform grid is known to produce Moire patterns from the interaction of thin near-parallel lines with the regularly spaced sampling points."[5]

aliasing[edit | edit source]

   " Our images look noisy and grainy near the boundary of the Mandelbrot set. The escape time bands get closer and closer, while the pixel spacing is fixed. The pixel grid samples isolated points of a mathematically abstract image defined on the continuous plane. The Nyquist-Shannon sampling theorem shows that sampling isolated points from a continuum is a valid approximation only so long as the values don’t change too quickly between the points. Aliasing occurs when the values do change too quickly compared to the sampling rate, with the grainy noisy visual effects as we have been. Because the escape time bands increase in number without bound as we approach the boundary of the Mandelbrot set, no sampling rate can be high enough." Claude Heiland-Allen[6]


How to[edit | edit source]

detect noise[edit | edit source]

   "To detect noise you first need to know the properties of your useful data. So if you have no prior knowledge of the input images then you Can not reliably detect noise." Spektre[7]

measure noise[edit | edit source]

  • "an objective measurement for image quality based on" the structural similarity [8]
  • noise rate = number of pixels that were recognized as noise. "To differentiate normal pixels from noise, I just calculated the medium value of its neighbor pixels and if its value was bigger than some critical value, we say that this one is noise."[9]
  • " Instead of classifying a pixel as noise if it exceeds such a threshold, you could measure the "error" and compute the variance or standard deviation for all of the pixels in the image. This would help you distinguish between having n pixels just above the threshold and n pixels way out whack. It also avoids the need to select a threshold." Adrian McCarthy
  • estimate the noise variance[10] If you get sigma > 10.0, then you have a noisy image ( only for grayscale)


// https://stackoverflow.com/questions/8960462/how-can-i-measure-image-noise
// noise rate by Vitalii Boiarskyi
if (ABS(1 - (currentPixel.R+currentPixel.G+currentPixel.B)/(neigborsMediumValues.R + neigboursMediumValues.G + neigboursMediumValues.B))) > criticalValue)
then
{
    currentPixelIsNoise = TRUE;
}


# https://stackoverflow.com/questions/2440504/noise-estimation-noise-measurement-in-image
# J. Immerkær, “Fast Noise Variance Estimation”, Computer Vision and Image Understanding, Vol. 64, No. 2, pp. 300-302, Sep. 1996


import math, 
import numpy as np 
from scipy.signal import convolve2d

def estimate_noise(I):

  H, W = I.shape # Tuple of image array dimensions.

  M = [[1, -2, 1],
       [-2, 4, -2],
       [1, -2, 1]]

  sigma = np.sum(np.sum(np.absolute(convolve2d(I, M))))
  sigma = sigma * math.sqrt(0.5 * math.pi) / (6 * (W-2) * (H-2))

  return sigma

remove noise[edit | edit source]

       "Noise reduction therefore quickly becomes an ‘AI-complete’ problem " Mark Scott Abeln [11]

names:

  • denoising
  • remove noise
  • noise reduction

software


Methods

  • High precision
  • perturbation technique
  • rebasing : rebase to new reference and carry on[12]
  • Bivariate Linear Approximation ( BLA)
  • Distance Estimation
  • Interior Detection: Keep track of derivatives at the critical point. When the absolute value of the derivative drops below a threshold such as 0.001

, classify it as interior and stop iterating.


precision[edit | edit source]

  • increasing precision

sampling[edit | edit source]


Enlargement of a 6×6 pixel raster graphic to 11×11 pixels (the low image resolutions in this example were chosen for better clarity; the principle is the same for higher resolutions).

  • 1: input image; the pixels are shown here as circles.
  • 2: The pixel grid of the output image, shown here as yellow crosses, is superimposed on the input image.
  • 3: The color values of the output image are calculated from the nearby pixels of the input image.
  • 4: Output image.


Image resampling


Image resampling reconstruction filter. Scaling using a radially symmetric reconstruction filter (carrier shown in green). A color value of the output image is calculated as a sum of color values of the input image weighted by the reconstruction filter.
When scaling using bilinear interpolation, a color value of the output image is calculated from the four closest color values of the input image.

postprocessing[edit | edit source]

  • with Image Magic[17]

mask[edit | edit source]

  • mask the grainy noise from aliasing ( fading-out)

dither[edit | edit source]

Dither is an intentionally applied form of noise used to randomize quantization error, preventing large-scale patterns such as color banding in images. [18][19]

dither to more accurately display graphics containing a greater range of colors than the display hardware is capable of showing:

  • The limited precision of 8bit (s)RGB means visible banding can occur, particularly in darker areas with smooth gradients. Adding dither trades off spatial resolution vs colour resolution, spreading the quantisation errors around so the end result is more perceptually uniform.[20]


It is simply and ease of implementation[21]

BLA[edit | edit source]

The iterations can be approximated by bivariate linear function( A linear function with with two variables is called a bivariate linear function):

 

For Mandelbrot set


For Mandelbrot set this is valid when: "non-linear part of the full perturbation iterations is so small that omitting it would cause fewer problems than the rounding error of the low precision data type"[22]

 



BLA can be used for

  • acceleration
  • avoiding glitches


Variants:

  • steps
    • Single Step BLA
    • Multiple step BLA
  • Non-Conformal BLA
  • ABS Variation BLA
  • Hybrid BLA
  • Multiple Critical Points

Examples[edit | edit source]

glitches[edit | edit source]

glitches

  • Incorrect parts of renders[23] using perturbation techique
  • pixel which dynamics differ significantly from the dynamics of the reference pixel[24]
  • pixel which is unevaluated ( unknown pixel) or glitched or otherwise bad

Types of glitches:[25]

  • noisy = isolated pixels
  • solid = The largest connected component of the set of such pixels

glitches in perturbation method[edit | edit source]

How to detect glitches:

  • heuristic developed by Pauldelbrot ( most common)[26]
  • heuristic using interval arithmetic developed by knighty[27]

How to choose reference point ( by Claude):

  • simple method: "take the first reference to be the center of the image, and correct any glitches that result (including those resulting from the reference escaping too early) by adding more references within the glitches, recalculating only those pixels that need it. A simple approach can still yield accurate results, albeit in less than optimal time"
  • " trying periodic points (the nuclei of the minibrot islands deep in the set) and preperiodic points (the Misiurewicz points at the centers of spirals), both of which can be found by Newton's method (finding their (pre)periods is a bit harder, but not impossible). Higher-period "structural" minibrot nuclei seem to be the most favoured as they are relatively easy to find while also emitting fewer glitched pixels than lower period nuclei"

Types of glitches by Claude:[28] 1. Reference escapes early, this type can be avoided by picking a non-escaping reference 2. Too-different dynamics (detected easily by Pauldelbrot's heuristic, detected accurately by gerrit's backwards error analysis, think knighty had another method too)

Type 1 can be improved by picking a random glitched pixel as the new reference and retrying

Type 2 can sometimes be fixed by using pixel with minimum |z| at the glitch iteration (possibly using derivative for 1 step of Newton's method to make it closer to a miniset), but often picking a random pixel works just as well - the advantage for minimum |z| comes for Mandelbrot set where you don't need to restart iterations from the beginning because minisets are periodic through 0 and the period is the glitch iteration (I use this in my mandelbrot-perturbator thing)

KF uses an algorithm I don't really understand for finding the "glitch center" based on pixel regions, but also has options for random choice and minimum |z| (without the fancy stuff from mandelbrot-perturbator). Locations:

  • "a minibrot near -2+0i at very deep zooms, chances are you'll end up with a Moire mess of stars, instead of concentric rings of rays (because the rays will be regularly spaced finer than the pixel spacing, leading to interference)."

See also[edit | edit source]

  • jagged and pixelated edges, colloquially known as "jaggies" ( see antialiasing)
  • Jitter is an
Supersampling - Jittering

References[edit | edit source]

  1. wikipedia: Image noise
  2. digital-photography-school : how-to-avoid-and-reduce-noise-in-your-images
  3. scikit-image.org docs: denoise
  4. mathworks: imnoise
  5. fractalforums.org : jitter-for-moire-reduction
  6. mandelbrot-book: noise
  7. stackoverflow question: javascript-image-noise-detection
  8. Image Quality Assessment: From Error Visibility to Structural Similarity by Zhou Wang, at al.
  9. stackoverflow question: how-can-i-measure-image-noise
  10. stackoverflow question : noise-estimation-noise-measurement-in-image
  11. there-is-detail-in-noise by Mark Scott Abeln
  12. fractalforums.org: Another solution to perturbation glitches
  13. fractalforums.org : restrict-recomputed-areas-with-iteration-increase
  14. fractalforums.org: jitter-for-moire-reduction
  15. fractalforums.org sampling
  16. poisson_disk_sampling by Cem Yuksel
  17. fractalforums.org: analytic-logde-post-processed-with-imagemagick
  18. Dither in wikipedia
  19. Marek Fiser: Is-16-million-colors-enough
  20. fractalforums: dithering-for-better-image-quality
  21. dither by Øyvind Kolås, pippin@gimp.org , august 2013
  22. fraktaler by Claude Heiland-Allen
  23. dinkydauset at deviantar :Perturbation-for-the-Mandelbrot-set-450766847
  24. math.stackexchange question: selecting-reference-orbit-for-fractal-rendering-with-perturbation-theory
  25. fractalforums.org : how-to-get-second-reference-when-using-perturbation-theory
  26. fractalforums " pertubation-theory-glitches-improvement
  27. fractalforums : *continued*-superfractalthing-arbitrary-precision-mandelbrot-set-rendering-in-ja/msg91505/#msg91505
  28. fractalforums.org : how-to-get-second-reference-when-using-perturbation-theory
  29. fractalforums.org: are-the-mandelbrot-sets-generated-different-in-appearance-to-the-actual-set
  30. Jitter in wikipedia
  31. matteo-basei : noise