bitmapped images-present

Upload: mjunghwa

Post on 08-Apr-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 Bitmapped Images-present

    1/23

    Bitmapped ImagesDigital Multimedia, 2nd edition

    Nigel Chapman & Jenny ChapmanChapter 5

  • 8/7/2019 Bitmapped Images-present

    2/23

    Bitmapped Images

    Also known as r aste r g r aphicsRecord a value for every pixel in the image

    Often created from an external source Scanner, digital camera,

    Painting programs allow direct creation of

    images with analogues of natural media,brushes,

  • 8/7/2019 Bitmapped Images-present

    3/23

  • 8/7/2019 Bitmapped Images-present

    4/23

    Image Resolution

    Array of pixels has pixel dimensions, but nophysical dimensions

    By default, displayed size depends onresolution (dpi) of output device physical dimension = pixel dimension/ r esolution

    Can store image r esolution (ppi) in image fileto maintain image's original size

    Scale by device r esolution/image r esolution

  • 8/7/2019 Bitmapped Images-present

    5/23

    Changing Resolution

    If image resolution < output device resolution,must interpolate extra pixels

    Always leads to loss of quality

    If image resolution > output device resolution,must downsample (disca r d pixels)

    Q uality will often be better than that of an image

    at device resolution (uses more information) Image sampled at a higher resolution than that of intended output device is ove r sampled

  • 8/7/2019 Bitmapped Images-present

    6/23

    Compression

    Image files may be too big for networktransmission, even at low resolutionsUse more sophisticated data representation ordiscard information to reduce data sizeEffectiveness of compression will depend onactual image data

    For any compression scheme, there willalways be some data for which 'compressed'version is actually bigger than the original

  • 8/7/2019 Bitmapped Images-present

    7/23

    Lossless Compression

    Always possible to decompress compresseddata and obtain an exact copy of the originaluncompressed data

    Data is just more efficiently arranged, none isdiscarded

    R un-length encoding ( RLE )

    Huffmann codingDictiona r y-based schemes LZ77 , LZ78 , LZW (LZW used in GIF, licence fee charged)

  • 8/7/2019 Bitmapped Images-present

    8/23

    JPEG Compression

    Lossy technique, well suited to photog r aphs,images with fine detail and continuous tonesConsider image as a spatially varying signalthat can be analysed in the frequency domainExperimental fact: people do not pe r ceive theeffect of high f r equencies in images ve r y

    accu r ately Hence, high frequency information can bediscarded without pe r ceptible loss of quality

  • 8/7/2019 Bitmapped Images-present

    9/23

    DCT

    Similar to Fourier Transform, analyses a signalinto its frequency components

    Takes array of pixel values, produces an arrayof coefficients of frequency components in theimageComputationally expensive process timeproportional to square of number of pixels

    Apply to 8x8 blocks of pixels

  • 8/7/2019 Bitmapped Images-present

    10/23

    JPEG Q uantization

    Applying DCT does not reduce data size Array of coefficients is same size as array of pixels

    Allows information about high frequencycomponents to be identified and discardedUse fewer bits (distinguish fewer differentvalues) for higher frequency components

    Number of levels for each frequencycoefficient may be specified separately in aquantization matrix

  • 8/7/2019 Bitmapped Images-present

    11/23

    JPEG Encoding

    After quantization, there will be many zerocoefficients

    Use RLE on z ig-zag sequence (maximi zes runs)

    Use Huffman coding of other coefficients (bestuse of available bits)

  • 8/7/2019 Bitmapped Images-present

    12/23

    JPEG Decompression

    Expand runs of zeros and decompressHuffman-encoded coefficients to reconstructarray of frequency coefficientsUse Inve r se Disc r ete Cosine T r ansfo r m to takedata back from frequency to spatial domainData discarded in quantization step of

    compression procedure cannot be recoveredReconstructed image is an approximation(usually very good) to the original image

  • 8/7/2019 Bitmapped Images-present

    13/23

    Compression Artefacts

    If use low quality setting (i.e. coarserquantization), boundaries between 8x8 blocksbecome visibleIf image has sharp edges these becomeblurred

    Rarely a problem with photographic images, butespecially bad with text

    Better to use good lossless method with text orcomputer-generated images

  • 8/7/2019 Bitmapped Images-present

    14/23

    Image Manipulation

    Many useful operations described by analogywith darkroom techniques for altering photos

    Correct deficiencies in image Remove 'red-eye', enhance contrast,

    Create artificial effects Filters: stylize, distort,

    Geometrical transformations Scale (change resolution), rotate,

  • 8/7/2019 Bitmapped Images-present

    15/23

    Selection

    No distinct objects (contrast vector graphics)Selection tools define an area of pixels

    Draw selection (pen tool, lasso) Select regular shape (rectangular, elliptical, 1px

    marquee tools) Select on basis of colour/edges (magic wand,

    magnetic lasso)

    Adjustments &c restricted to selected area

  • 8/7/2019 Bitmapped Images-present

    16/23

    Masks

    Area not selected is p r otected, as if masked by stencil

    Can represent on/off mask as array of 1 bit perpixel (b/w image)Generalize to greyscale image(semitransparent mask) alpha channel

    Feathered and anti-aliased selections Use as laye r mask to modify laye r compositing

  • 8/7/2019 Bitmapped Images-present

    17/23

    Pixel Point Processing

    Compute new value for pixel from its old value p' = f(p), f is a mapping function

    In greyscale images, ppp alters brightness andcontrast Compensate for poor exposure, bad lighting, bring

    out detail Use with mask to adjust parts of image

    (e.g.shadows and highlights)

  • 8/7/2019 Bitmapped Images-present

    18/23

    Adjustments in Photoshop

    Brightness and contrast sliders Adjust slope and intercept of linear f

    Levels dialogue Adjust endpoints by setting white and black levels Use image histog r am to choose values visually

    Curves dialogue Interactively adjust shape of graph of f

  • 8/7/2019 Bitmapped Images-present

    19/23

    Pixel Group Processing

    Compute new value for pixel from its old valueand the values of surrounding pixels

    F ilte r ing ope r ations

    Compute weighted average of pixel values Array of weights k/a convolution mask Pixels used in convolution k/a convolution ke r nel

    Computationally intensive process

  • 8/7/2019 Bitmapped Images-present

    20/23

    Blurring

    Classic simple blur Convolution mask with equal weights

    Unnatural effect Gaussian blur

    Convolution mask with coefficients falling off gradually(Gaussian bell curve)

    More gentle, can set amount and radius

  • 8/7/2019 Bitmapped Images-present

    21/23

    Sharpening

    Low frequency filter 3x3 convolution mask coefficients all equal to -1,

    except centre = 9 Produces harsh edges

    Unsharp masking Copy image, apply Gaussian blur to copy, subtract

    it from originalEnhances image features

  • 8/7/2019 Bitmapped Images-present

    22/23

    Geometrical Transformations

    Scaling, rotation, etc. Simple operations in vector graphics Requires each pixel to be transformed in

    bitmapped image

    Transformations may 'send pixels into gaps i.e. inte r polation is r equi r ed

    Equivalent to reconstruction & resampling; tends todegrade image quality

  • 8/7/2019 Bitmapped Images-present

    23/23

    Interpolation

    N ea r est neighbou r Use value of pixel whose centre is closest in the

    original image to real coordinates of ideal interpolated

    pixelB ilinea r inte r polation

    Use value of all four adjacent pixels, weighted byintersection with target pixel

    B icubic inte r polation Use values of all four adjacent pixels, weighted using

    cubic splines