Assignments
Assignments
Image::Image32 Class Reference

#include <image.h>

Classes

struct  iterator
 

Public Member Functions

iterator begin (void)
 
iterator end (void)
 
 Image32 (void)
 
 Image32 (const Image32 &img)
 
 Image32 (Image32 &&img)
 
Image32operator= (const Image32 &img)
 
Image32operator= (Image32 &&img)
 
 ~Image32 (void)
 
void setSize (int width, int height)
 
int width (void) const
 
int height (void) const
 
Pixel32operator() (int x, int y)
 
const Pixel32operator() (int x, int y) const
 
void read (std::string fileName)
 
void write (std::string fileName) const
 
Image32 addRandomNoise (double noise) const
 
Image32 brighten (double brightness) const
 
Image32 luminance (void) const
 
Image32 contrast (double contrast) const
 
Image32 saturate (double saturation) const
 
Image32 quantize (int bits) const
 
Image32 randomDither (int bits) const
 
Image32 orderedDither2X2 (int bits) const
 
Image32 floydSteinbergDither (int bits) const
 
Image32 blur3X3 (void) const
 
Image32 edgeDetect3X3 (void) const
 
Image32 scaleNearest (double scaleFactor) const
 
Image32 scaleBilinear (double scaleFactor) const
 
Image32 scaleGaussian (double scaleFactor) const
 
Image32 rotateNearest (double angle) const
 
Image32 rotateBilinear (double angle) const
 
Image32 rotateGaussian (double angle) const
 
void setAlpha (const Image32 &matte)
 
Image32 composite (const Image32 &overlay) const
 
Image32 crop (int x1, int y1, int x2, int y2) const
 
Image32 funFilter (void) const
 
Image32 warp (const OrientedLineSegmentPairs &olsp) const
 
Pixel32 nearestSample (Util::Point2D p) const
 
Pixel32 bilinearSample (Util::Point2D p) const
 
Pixel32 gaussianSample (Util::Point2D p, double variance, double radius) const
 

Static Public Member Functions

static Image32 BeierNeelyMorph (const Image32 &source, const Image32 &destination, const OrientedLineSegmentPairs &olsp, double timeStep)
 
static Image32 CrossDissolve (const Image32 &source, const Image32 &destination, double blendWeight)
 

Private Member Functions

void _assertInBounds (int x, int y) const
 

Private Attributes

int _width
 
int _height
 
Pixel32_pixels
 

Detailed Description

This class represents an RGBA image with 8 bits per channel.

Constructor & Destructor Documentation

◆ Image32() [1/3]

Image32::Image32 ( void  )

The default constructor

◆ Image32() [2/3]

Image32::Image32 ( const Image32 img)

The copy constructor copies pixel values

◆ Image32() [3/3]

Image32::Image32 ( Image32 &&  img)

The move constructor moves pixel ownership from the input to the new object.

◆ ~Image32()

Image32::~Image32 ( void  )

The destructor deallocates memory associated with the image.

Member Function Documentation

◆ _assertInBounds()

void Image32::_assertInBounds ( int  x,
int  y 
) const
private

The method validates that the pixel index is valid

◆ addRandomNoise()

Image32 Image32::addRandomNoise ( double  noise) const

This method outputs a new image image with random noise added to each pixel. The value of the input parameter should be in the range [0,1] representing the fraction of noise that should be added. The actual amount of noise added is in the range [-noise,noise].

◆ begin()

iterator Image::Image32::begin ( void  )
inline

◆ BeierNeelyMorph()

Image32 Image32::BeierNeelyMorph ( const Image32 source,
const Image32 destination,
const OrientedLineSegmentPairs olsp,
double  timeStep 
)
static

This static method outputs the result a Beier-Neely morph. The method uses the set of line segment pairs to define correspondences between the source and destination image. The time-step parameter, in the range of [0,1], specifies the point in the morph at which the output image should be obtained.

◆ bilinearSample()

Pixel32 Image32::bilinearSample ( Util::Point2D  p) const

This method returns the value of the image, sampled at position p using bilinear-weighted sampling.

◆ blur3X3()

Image32 Image32::blur3X3 ( void  ) const

This method outputs a blur of the image using a 3x3 mask.

◆ brighten()

Image32 Image32::brighten ( double  brightness) const

This method outputs a new image in which each pixel is brightened. The value of the input parameter is the scale by which the image should be brightened.

◆ composite()

Image32 Image32::composite ( const Image32 overlay) const

This method outputs an image that is a composite of the current image and the overlay. The method uses the values in the alpha-channel of the overlay image to determine how pixels should be blended.

◆ contrast()

Image32 Image32::contrast ( double  contrast) const

This method outputs a new image in which the contract has been changed. The value of the input parameter is the scale by which the contrast of the image should be changed.

◆ crop()

Image32 Image32::crop ( int  x1,
int  y1,
int  x2,
int  y2 
) const

This method outputs a croppedimage. The values of the input parameters specify the corners of the cropping rectangle.

◆ CrossDissolve()

Image32 Image32::CrossDissolve ( const Image32 source,
const Image32 destination,
double  blendWeight 
)
static

This static method outputs the cross-dissolve of two image. The method generates an image which is the blend of the source and destination, using the blend-weight in the range [0,1] to determine what faction of the source and destination images should be used to generate the final output.

◆ edgeDetect3X3()

Image32 Image32::edgeDetect3X3 ( void  ) const

This method outpus a new image highlighting the edges in the input using a 3x3 mask.

◆ end()

iterator Image::Image32::end ( void  )
inline

◆ floydSteinbergDither()

Image32 Image32::floydSteinbergDither ( int  bits) const

This method outputs a new image in which each pixel is represented by a fixed number of bits. The final pixel values are obtained by using Floyd-Steinberg dithering for propogating quantization errors. The value of the input parameter is the number of bits that should be used to represent a color component in the output image.

◆ funFilter()

Image32 Image32::funFilter ( void  ) const

This method outputs the results of a fun-filter.

◆ gaussianSample()

Pixel32 Image32::gaussianSample ( Util::Point2D  p,
double  variance,
double  radius 
) const

This method returns the value of the image, sampled at position p using Gaussian-weighted sampling. The variance of the Gaussian and the radius over which the weighted summation is performed are specified by the parameters.

◆ height()

int Image32::height ( void  ) const

This method returns the height of the image

◆ luminance()

Image32 Image32::luminance ( void  ) const

This method outputs the gray-scale image.

◆ nearestSample()

Pixel32 Image32::nearestSample ( Util::Point2D  p) const

This method returns the value of the image, sampled at position p using nearest-point sampling.

◆ operator()() [1/2]

Pixel32 & Image32::operator() ( int  x,
int  y 
)

This method returns a reference to the indexed pixel. An exception is thrown if the index is out of bounds.

◆ operator()() [2/2]

const Pixel32 & Image32::operator() ( int  x,
int  y 
) const

This method returns a reference to the indexed pixel. An exception is thrown if the index is out of bounds.

◆ operator=() [1/2]

Image32 & Image32::operator= ( const Image32 img)

The copy assignment operator copies pixel values

◆ operator=() [2/2]

Image32 & Image32::operator= ( Image32 &&  img)

The move assignment operator moves pixel ownership from the input to the new object.

◆ orderedDither2X2()

Image32 Image32::orderedDither2X2 ( int  bits) const

This method outputs a new image in which each pixel is represented by a fixed number of bits. The final pixel values are obtained by using a 2x2 dithering matrix to determine how values should be quantized. The value of the input parameter is the number of bits that should be used to represent a color component in the output image.

◆ quantize()

Image32 Image32::quantize ( int  bits) const

This method outputs a new image in which each pixel is represented by a fixed number of bits. The final pixel values are obtained by quantizing. The value of the input parameter is the number of bits that should be used to represent a color component in the output image.

◆ randomDither()

Image32 Image32::randomDither ( int  bits) const

This method outputs a new image in which each pixel is represented by a fixed number of bits. The final pixel values are obtained by adding noise to the pixel color channels and then quantizing. The value of the input parameter is the number of bits that should be used to represent a color component in the output image.

◆ read()

void Image32::read ( std::string  fileName)

This method reads in an image from the specified file. It uses the file extension to determine if the file should be read in as a BMP file or as a JPEG file.

◆ rotateBilinear()

Image32 Image32::rotateBilinear ( double  angle) const

This method outputs a rotated image which is obtained using bilinear sampling. The value of the input parameter is the angle of rotation (in degrees).

◆ rotateGaussian()

Image32 Image32::rotateGaussian ( double  angle) const

This method outputs a rotated image which is obtained using Gaussian sampling. The value of the input parameter is the angle of rotation (in degrees).

◆ rotateNearest()

Image32 Image32::rotateNearest ( double  angle) const

This method outputs a rotated image which is obtained using nearest-point sampling. The value of the input parameter is the angle of rotation (in degrees).

◆ saturate()

Image32 Image32::saturate ( double  saturation) const

This method outputs a new image in which the saturation of each pixel has been changed. The value of the input parameter is the scale by which the saturation of the pixel should be changed.

◆ scaleBilinear()

Image32 Image32::scaleBilinear ( double  scaleFactor) const

This method outputs a scaled image which is obtained using bilinear sampling. The value of the input parameter is the factor by which the image is to be scaled.

◆ scaleGaussian()

Image32 Image32::scaleGaussian ( double  scaleFactor) const

This method outputs a scaled image which is obtained using Gaussian sampling. The value of the input parameter is the factor by which the image is to be scaled.

◆ scaleNearest()

Image32 Image32::scaleNearest ( double  scaleFactor) const

This method outputs a scaled image which is obtained using nearest-point sampling. The value of the input parameter is the factor by which the image is to be scaled.

◆ setAlpha()

void Image32::setAlpha ( const Image32 matte)

This method sets the alpha-channel of the current image using the information provided in the matte image. The method returns true if it has been implemented.

◆ setSize()

void Image32::setSize ( int  width,
int  height 
)

This method sets the dimension of the image.

◆ warp()

Image32 Image32::warp ( const OrientedLineSegmentPairs olsp) const

This method outputs a warped image using the correspondences defined by the line segment pairs.

◆ width()

int Image32::width ( void  ) const

This method returns the width of the image

◆ write()

void Image32::write ( std::string  fileName) const

This method writes in an image out to the specified file. It uses the file extension to determine if the file should be written out as a BMP file or as a JPEG file.

Member Data Documentation

◆ _height

int Image::Image32::_height
private

◆ _pixels

Pixel32* Image::Image32::_pixels
private

The pixel values

◆ _width

int Image::Image32::_width
private

The dimensions of the image


The documentation for this class was generated from the following files: