STIRA
0.1
|
A class to hold image data. It consists of three things: the actual image data, the corresponding metadata and some operations that can be executed on an image as a whole. The image data arev stored as a vector of ArrayGrids that represent the spectral bands (like red, green, blue, ...) of an image. More...
#include <Image.h>
Public Member Functions | |
Image (int width, int height) | |
Constructor. Creates an empty image with given width and height. More... | |
Image (int width, int height, int nrBands) | |
Constructor. Creates an image with one band with given width, height and number of bands. More... | |
Image (ArrayGrid< double > *pDataGrid) | |
Constructor. Creates an image with one band ArrayGrid as the only band. More... | |
Image (ArrayGrid< bool > *pBoolGrid) | |
Constructor. Creates an image with one band created from a boolean grid with value 0 for false and 255 for true = 255. More... | |
~Image () | |
Destructor. | |
std::string | GetImageName () |
gets the name for this image | |
void | SetImageName (std::string imagename) |
sets the name for this image to "imagename" More... | |
Image * | Clone () |
Makes a new image that is an exact, independant copy of the current image. Also known as "deep copy". | |
Image (Image &otherImage) | |
Copy constructor. More... | |
Image * | ExtractROIAsNewImage (common::RectangularROI< int > rroi) |
Creates a new image cropped from ROI of this image. More... | |
bool | InsertSubImage (Image *pSubImage, int xTop, int yTop) |
overwrites part of an image with a subimage More... | |
void | AddBand (ArrayGrid< double > *pBand) |
adds a new band to the image. More... | |
void | RemoveBand (ArrayGrid< double > *pBand) |
removes a band from the image. More... | |
void | RemoveBand (int i) |
removes a band from the image. More... | |
void | ReplaceBand (ArrayGrid< double > *pBandOld, ArrayGrid< double > *pBandNew) |
replaces the old band by the new band The old band is deleted!! More... | |
std::vector< ArrayGrid< double > * > & | GetBands () |
gets the STL vector containing the image bands. | |
int | GetWidth () |
gets the width of this images. | |
int | GetHeight () |
gets the height of this image. | |
int | GetNumberOfBands () |
gets the number of bands in this image. | |
void | GetMinMax (double &outMin, double &outMax, int &minBandNr, int &maxBandNr) |
Gets the minimum and maximum present in the current image. More... | |
void | GetMinMax (double &outMin, double &outMax) |
Gets the minimum and maximum present in the current image. More... | |
double | GetAbsMax () |
Gets the largest absolute value present in this image. More... | |
void | Rescale (double mmin=0.0, double mmax=255.0) |
Linearly rescales image intensities Values are rescaled from old min and max value over all bands to new min and max value for all bands. More... | |
void | CopyImageValues (Image *pOtherImage) |
replace intensities in this image by intensities of another image Condition: image has same width, height and number of bands; if not, nothing happens... | |
void | ClipImageValues (double clippedMin, double clippedMax) |
void | MultiplyWith (Image *pImg) |
multiplies image point by point with another image More... | |
void | Scale (double factor) |
scales all image intensities with a certain factor More... | |
void | AddGaussianNoise (double sigma, bool isColored=true) |
adds Gaussian noise to current image More... | |
void | ApplyPoissonNoise (double factor, bool isColored=true) |
applies Poisson noise to current image Here, we assume that the image is scaled for visualization, and that the underlying measured intensities can be recomputed by applying a factor More... | |
void | ApplySaltAnPepperNoise (double fraction, bool isColored=true) |
applies salt&pepper noise to current image More... | |
ColorValue | GetColor (int x, int y) |
Gets color at given coordinates (x, y) More... | |
ColorValue | GetColor (common::Point< int > pt) |
Gets color at given coordinates (x, y) More... | |
void | SetColor (int x, int y, ColorValue cv) |
Gets color at given coordinates (x, y) More... | |
void | SetColor (common::Point< int > pt, ColorValue cv) |
Sets color at given point pt. More... | |
bool | HSVToRGB () |
Converts image from HSV color representation to RGB. More... | |
bool | RGBToHSV () |
Converts image from RGB color representation to HSV. More... | |
bool | HSIToRGB () |
Converts image from HSI color representation to RGB. More... | |
bool | RGBToHSI () |
Converts image from RGB color representation to HSI. More... | |
bool | HSLToRGB () |
Converts image from HSL color representation to RGB. More... | |
bool | RGBToHSL () |
Converts image from RGB color representation to HSL. More... | |
bool | sRGBToXYZ (ColorValue referenceIlluminant=ColorConstants::sD65_XYZ) |
Converts image from sRGB color representation to XYZ. More... | |
bool | XYZTosRGB (ColorValue referenceIlluminant=ColorConstants::sD65_XYZ) |
Converts image from XYZ color representation to sRGB. More... | |
bool | AdobeRGBToXYZ (ColorValue referenceIlluminant=ColorConstants::sD65_XYZ) |
Converts image from AdobeRGB color representation to XYZ. More... | |
bool | XYZToAdobeRGB (ColorValue referenceIlluminant=ColorConstants::sD65_XYZ) |
Converts image from XYZ color representation to AdobeRGB. More... | |
bool | sRGBToLuv (ColorValue referenceIlluminant=ColorConstants::sD65_XYZ) |
Converts image from sRGB color representation to Luv. More... | |
bool | LuvTosRGB (ColorValue referenceIlluminant=ColorConstants::sD65_XYZ) |
Converts image from Luv color representation to sRGB. More... | |
bool | sRGBToLab (ColorValue referenceIlluminant=ColorConstants::sD65_XYZ) |
Converts image from sRGB color representation to (CIE)Lab. More... | |
bool | LabTosRGB (ColorValue referenceIlluminant=ColorConstants::sD65_XYZ) |
Converts image from (CIE)Lab color representation to sRGB. More... | |
bool | RGBToYUV () |
Converts image from RGB color representation to YUV. More... | |
bool | YUVToRGB () |
Converts image from YUV color representation to RGB. More... | |
bool | RGBToCMY () |
Converts image from RGB color representation to CMY. More... | |
bool | CMYToRGB () |
Converts image from XYZ color representation to sRGB. More... | |
A class to hold image data. It consists of three things: the actual image data, the corresponding metadata and some operations that can be executed on an image as a whole. The image data arev stored as a vector of ArrayGrids that represent the spectral bands (like red, green, blue, ...) of an image.
stira::imagedata::Image::Image | ( | int | width, |
int | height | ||
) |
Constructor. Creates an empty image with given width and height.
This image just has metadata, and no data structures allocated yet!! Bands must still be added.
width | width of image to be constructed |
height | height of image to be constructed |
type | underlying data type of image (not used yet) |
stira::imagedata::Image::Image | ( | int | width, |
int | height, | ||
int | nrBands | ||
) |
Constructor. Creates an image with one band with given width, height and number of bands.
width | width of image to be constructed |
height | height of image to be constructed |
nrBands | number of bands for image to be constructed |
stira::imagedata::Image::Image | ( | ArrayGrid< double > * | pDataGrid | ) |
Constructor. Creates an image with one band ArrayGrid as the only band.
pDataGrid | data grid to take as band in the image |
References stira::imagedata::ArrayGrid< T >::GetHeight(), and stira::imagedata::ArrayGrid< T >::GetWidth().
stira::imagedata::Image::Image | ( | ArrayGrid< bool > * | pBoolGrid | ) |
Constructor. Creates an image with one band created from a boolean grid with value 0 for false and 255 for true = 255.
pBoolGrid | data grid to take as band in the image |
References stira::imagedata::ArrayGrid< T >::GetHeight(), stira::imagedata::ArrayGrid< T >::GetValue(), stira::imagedata::ArrayGrid< T >::GetWidth(), and stira::imagedata::ArrayGrid< T >::SetValue().
stira::imagedata::Image::Image | ( | Image & | otherImage | ) |
Copy constructor.
otherImage | image to construct new image from |
References GetBands(), GetHeight(), GetImageName(), GetNumberOfBands(), and GetWidth().
void stira::imagedata::Image::AddBand | ( | ArrayGrid< double > * | pBand | ) |
adds a new band to the image.
pBand | band to be added to the image |
References stira::imagedata::ArrayGrid< T >::GetHeight(), and stira::imagedata::ArrayGrid< T >::GetWidth().
Referenced by stira::fouriertools::FFT::Convolve(), stira::imagetools::ImageTools::CreateImageSSD(), stira::imagetools::ImageTools::CreateImageSSIM(), stira::imagetools::ImageTools::CropBorder(), stira::filter::GaussConvolve::DerivativeConvolveFFT(), stira::filter::GaussConvolve::DerivativeConvolveSeparable(), stira::imagetools::DrawImageTools::DrawBoolOnInput(), stira::fouriertools::FFT::GaussConvolve(), stira::imagetools::ImageTools::MirrorBorder(), stira::imagetools::ImageTools::PaddBorder(), stira::imagetools::ImageTools::Rotate180Degrees(), stira::imagetools::ImageTools::Rotate90DegreesClockwise(), stira::imagetools::ImageTools::Rotate90DegreesCounterClockwise(), stira::imagetools::RigidTransform::RotateAroundCenter(), stira::contrastenhance::AdaptiveEnhanceLuong::Run(), stira::deconvolve::WienerDeconvolve::Run(), stira::pyramidapplications::PyramidContrastEnhancer::Run(), stira::filter::DifferenceOfGaussians::Run(), stira::pyramidapplications::PyramidContrastEnhancer::Run3Colors(), stira::filter::SeparableFilter::RunColumnRow(), stira::filter::MedianFilter::RunHybridMedian(), stira::filter::MedianFilter::RunMedian(), stira::filter::SeparableFilter::RunRowColumn(), stira::filter::NonSeparableFilter::RunSobelX(), stira::filter::NonSeparableFilter::RunSobelY(), stira::filter::GaussConvolve::UpsampleGaussianInterpolated(), stira::histogram::JointHistogram::VisualizeAsImage(), and stira::contrastenhance::Retinex::~Retinex().
void stira::imagedata::Image::AddGaussianNoise | ( | double | sigma, |
bool | isColored = true |
||
) |
adds Gaussian noise to current image
sigma | sigma of the noise to add |
isColored | flag if the noise to apply is colored or not |
References stira::common::MathUtils::ClipValue(), stira::imagedata::ArrayGrid< T >::GetValue(), and stira::imagedata::ArrayGrid< T >::SetValue().
bool stira::imagedata::Image::AdobeRGBToXYZ | ( | ColorValue | referenceIlluminant = ColorConstants::sD65_XYZ | ) |
Converts image from AdobeRGB color representation to XYZ.
referenceIlluminant | reference illuminant (or white point) |
References stira::imagedata::TransformColorSpace::AdobeRGBtoXYZ(), and stira::imagedata::TransformColorSpace::SetReferenceWhite().
void stira::imagedata::Image::ApplyPoissonNoise | ( | double | factor, |
bool | isColored = true |
||
) |
applies Poisson noise to current image Here, we assume that the image is scaled for visualization, and that the underlying measured intensities can be recomputed by applying a factor
factor | factor with which the "measured" image values were multiplied to get them in the current range |
isColored | flag if the noise to apply is colored or not |
References stira::imagedata::ColorValue::c, stira::common::MathUtils::ClipValue(), stira::imagedata::ArrayGrid< T >::GetValue(), stira::imagedata::TransformColorSpace::HSVtoRGB(), stira::imagedata::TransformColorSpace::RGBtoHSV(), and stira::imagedata::ArrayGrid< T >::SetValue().
void stira::imagedata::Image::ApplySaltAnPepperNoise | ( | double | fraction, |
bool | isColored = true |
||
) |
applies salt&pepper noise to current image
fraction | fraction of the pixels to be corrupted |
isColored | flag if the noise to apply is colored or not |
References stira::imagedata::ArrayGrid< T >::SetValue().
bool stira::imagedata::Image::CMYToRGB | ( | ) |
Converts image from XYZ color representation to sRGB.
References stira::imagedata::TransformColorSpace::CMYtoRGB().
Image * stira::imagedata::Image::ExtractROIAsNewImage | ( | common::RectangularROI< int > | rroi | ) |
Creates a new image cropped from ROI of this image.
rroi | rectangular ROI to create new subimage from |
References GetBands(), stira::common::RectangularROI< T >::GetHeight(), stira::common::RectangularROI< T >::GetTopLeftCorner(), stira::common::RectangularROI< T >::GetWidth(), stira::common::Point< T >::x, and stira::common::Point< T >::y.
double stira::imagedata::Image::GetAbsMax | ( | ) |
Gets the largest absolute value present in this image.
ColorValue stira::imagedata::Image::GetColor | ( | int | x, |
int | y | ||
) |
Gets color at given coordinates (x, y)
References stira::imagedata::ColorValue::c.
Referenced by stira::imagetools::ChromaticAdaptation::AdaptLabColor(), stira::imagetools::ImageTools::ConvertToGrayImage(), stira::imagetools::ImageTools::CreateIntArrayFromColorImage(), and stira::imagetools::ColorBalancer::RunPerfectReflector().
ColorValue stira::imagedata::Image::GetColor | ( | common::Point< int > | pt | ) |
Gets color at given coordinates (x, y)
References stira::common::Point< T >::x, and stira::common::Point< T >::y.
void stira::imagedata::Image::GetMinMax | ( | double & | outMin, |
double & | outMax, | ||
int & | minBandNr, | ||
int & | maxBandNr | ||
) |
Gets the minimum and maximum present in the current image.
outMin | minimum value actually present in current image |
outMax | maximum value actually present in current image |
minBandNr | number of color band in which the minimum value was found |
maxBandNr | number of color band in which the maximum value was found |
void stira::imagedata::Image::GetMinMax | ( | double & | outMin, |
double & | outMax | ||
) |
Gets the minimum and maximum present in the current image.
outMin | minimum value actually present in current image |
outMax | maximum value actually present in current image |
bool stira::imagedata::Image::HSIToRGB | ( | ) |
Converts image from HSI color representation to RGB.
References stira::imagedata::TransformColorSpace::HSItoRGB().
Referenced by stira::contrastenhance::HistogramTools::HistogramEqualizeHSI().
bool stira::imagedata::Image::HSLToRGB | ( | ) |
Converts image from HSL color representation to RGB.
References stira::imagedata::TransformColorSpace::HSLtoRGB().
bool stira::imagedata::Image::HSVToRGB | ( | ) |
Converts image from HSV color representation to RGB.
References stira::imagedata::TransformColorSpace::HSVtoRGB().
bool stira::imagedata::Image::InsertSubImage | ( | Image * | pSubImage, |
int | xTop, | ||
int | yTop | ||
) |
overwrites part of an image with a subimage
pSubImage | image to insert |
xTop | x coordinate in parent image where to insert top left corner of sub image |
yTop | y coordinate in parent image where to insert top left corner of sub image |
References GetBands(), GetHeight(), GetNumberOfBands(), and GetWidth().
bool stira::imagedata::Image::LabTosRGB | ( | ColorValue | referenceIlluminant = ColorConstants::sD65_XYZ | ) |
Converts image from (CIE)Lab color representation to sRGB.
referenceIlluminant | reference illuminant (or white point) |
References stira::imagedata::TransformColorSpace::LabtosRGB(), and stira::imagedata::TransformColorSpace::SetReferenceWhite().
Referenced by stira::contrastenhance::HistogramTools::ColorHistogramEqualize().
bool stira::imagedata::Image::LuvTosRGB | ( | ColorValue | referenceIlluminant = ColorConstants::sD65_XYZ | ) |
Converts image from Luv color representation to sRGB.
referenceIlluminant | reference illuminant (or white point) |
References stira::imagedata::TransformColorSpace::LuvtosRGB(), and stira::imagedata::TransformColorSpace::SetReferenceWhite().
void stira::imagedata::Image::MultiplyWith | ( | Image * | pImg | ) |
multiplies image point by point with another image
pImg | other image to multiply current image with |
References GetBands(), GetHeight(), GetNumberOfBands(), and GetWidth().
Referenced by stira::contrastenhance::Retinex::RunMSRCR().
void stira::imagedata::Image::RemoveBand | ( | ArrayGrid< double > * | pBand | ) |
removes a band from the image.
pBand | band to be removed from the image |
void stira::imagedata::Image::RemoveBand | ( | int | i | ) |
removes a band from the image.
i | index of band to be removed from the image |
void stira::imagedata::Image::ReplaceBand | ( | ArrayGrid< double > * | pBandOld, |
ArrayGrid< double > * | pBandNew | ||
) |
replaces the old band by the new band The old band is deleted!!
pBandOld | pointer to old band |
pBandNew | pointer to band that will replace the old band |
void stira::imagedata::Image::Rescale | ( | double | mmin = 0.0 , |
double | mmax = 255.0 |
||
) |
Linearly rescales image intensities Values are rescaled from old min and max value over all bands to new min and max value for all bands.
mmin | minimum value after rescaling |
mmax | maximum value after rescaling |
bool stira::imagedata::Image::RGBToCMY | ( | ) |
Converts image from RGB color representation to CMY.
References stira::imagedata::TransformColorSpace::RGBtoCMY().
bool stira::imagedata::Image::RGBToHSI | ( | ) |
Converts image from RGB color representation to HSI.
References stira::imagedata::TransformColorSpace::RGBtoHSI().
Referenced by stira::contrastenhance::HistogramTools::HistogramEqualizeHSI().
bool stira::imagedata::Image::RGBToHSL | ( | ) |
Converts image from RGB color representation to HSL.
References stira::imagedata::TransformColorSpace::RGBtoHSL().
bool stira::imagedata::Image::RGBToHSV | ( | ) |
Converts image from RGB color representation to HSV.
References stira::imagedata::TransformColorSpace::RGBtoHSV().
bool stira::imagedata::Image::RGBToYUV | ( | ) |
Converts image from RGB color representation to YUV.
References stira::imagedata::TransformColorSpace::RGBtoYUV().
Referenced by stira::imagetools::ColorBalancer::RunPerfectReflector().
void stira::imagedata::Image::Scale | ( | double | factor | ) |
scales all image intensities with a certain factor
factor | factor to scale pixel intensities with |
void stira::imagedata::Image::SetColor | ( | int | x, |
int | y, | ||
ColorValue | cv | ||
) |
Gets color at given coordinates (x, y)
References stira::imagedata::ColorValue::c.
Referenced by stira::imagetools::ChromaticAdaptation::AdaptLabColor(), stira::filter::LocalBinaryPattern::ComputeJensenShannonDivergenceBetweenImagePatches(), stira::imagetools::ImageTools::ConvertToSepiaImage(), stira::imagetools::ImageTools::CreateColorImageFromIntArray(), stira::imagetools::FractalGenerator::CreateJulia(), stira::imagetools::FractalGenerator::CreateMandelbrot(), stira::imagetools::DrawImageTools::DrawBoolOnInput(), stira::imagetools::DrawImageTools::DrawPoint(), stira::imagetools::PerlinNoise::Generate(), stira::imagetools::GretagMacbethColorChecker::Generate(), stira::imagetools::TextureGenerator::GenerateMarble(), stira::imagetools::PerlinNoise::GenerateNormalized(), stira::imagetools::TextureGenerator::GenerateWood(), stira::imagetools::DrawImageTools::Plot8CirclePoints(), and stira::imagetools::TextureGenerator::~TextureGenerator().
void stira::imagedata::Image::SetColor | ( | common::Point< int > | pt, |
ColorValue | cv | ||
) |
Sets color at given point pt.
References stira::common::Point< T >::x, and stira::common::Point< T >::y.
void stira::imagedata::Image::SetImageName | ( | std::string | imagename | ) |
sets the name for this image to "imagename"
imagename | name to set for this image |
Referenced by stira::imagetools::ImageTools::ApplyGamma(), stira::imagetools::ImageTools::ApplyJetColorMap(), stira::contrastenhance::HistogramTools::ColorHistogramEqualize(), stira::imagetools::ImageTools::ConvertToGrayImage(), stira::imagetools::ImageTools::ConvertToSepiaImage(), stira::imagetools::ImageTools::CreateCheckeredImage(), stira::imagetools::ImageTools::CreateImageSSD(), stira::imagetools::ImageTools::CreateImageSSIM(), stira::imagetools::ImageTools::CreateTransparantlyMixedImage(), stira::filter::GaussConvolve::DerivativeConvolveFFT(), stira::filter::GaussConvolve::DerivativeConvolveSeparable(), stira::filter::LogGabor::GetMagnitude(), stira::filter::LogGabor::GetTransferFunction(), stira::contrastenhance::HistogramTools::HistogramEqualizeHSI(), stira::contrastenhance::HistogramTools::HistogramEqualizePerBand(), stira::imagetools::ImageIO::ReadPGMasInt(), stira::filter::KuwaharaFilter::Run(), stira::filter::LaplacianOfGaussianFilter::Run(), stira::deconvolve::WienerDeconvolve::Run(), stira::filter::AdaptiveBilateralFilter::Run(), stira::deconvolve::TikhonovMillerDeconvolve::Run(), stira::deconvolve::GNCDeconvolve::Run(), stira::deconvolve::RichardsonLucyDeconvolve::Run(), stira::deconvolve::VanCittertLandweberDeconvolve::Run(), stira::filter::NonLocalMeansFilter::Run(), stira::imagetools::ColorBalancer::RunBalance(), stira::filter::LocalBinaryPattern::RunClassic(), stira::imagetools::ColorBalancer::RunGrayWorld(), stira::filter::MedianFilter::RunHybridMedian(), stira::filter::MedianFilter::RunMedian(), stira::contrastenhance::Retinex::RunMSRCR(), stira::imagetools::ColorBalancer::RunPerfectReflector(), stira::filter::GaussConvolve::UpsampleGaussianInterpolated(), stira::imagedata::OrientationGrid::VisualizeMagnitudeImage(), stira::imagedata::OrientationGrid::VisualizeOrientationImage(), stira::contrastenhance::Retinex::~Retinex(), and stira::filter::UnsharpMask::~UnsharpMask().
bool stira::imagedata::Image::sRGBToLab | ( | ColorValue | referenceIlluminant = ColorConstants::sD65_XYZ | ) |
Converts image from sRGB color representation to (CIE)Lab.
referenceIlluminant | reference illuminant (or white point) |
References stira::imagedata::TransformColorSpace::SetReferenceWhite(), and stira::imagedata::TransformColorSpace::sRGBtoLab().
Referenced by stira::contrastenhance::HistogramTools::ColorHistogramEqualize(), and stira::imagetools::ColorBalancer::RunPerfectReflector().
bool stira::imagedata::Image::sRGBToLuv | ( | ColorValue | referenceIlluminant = ColorConstants::sD65_XYZ | ) |
Converts image from sRGB color representation to Luv.
referenceIlluminant | reference illuminant (or white point) |
References stira::imagedata::TransformColorSpace::SetReferenceWhite(), and stira::imagedata::TransformColorSpace::sRGBtoLuv().
bool stira::imagedata::Image::sRGBToXYZ | ( | ColorValue | referenceIlluminant = ColorConstants::sD65_XYZ | ) |
Converts image from sRGB color representation to XYZ.
referenceIlluminant | reference illuminant (or white point) |
References stira::imagedata::TransformColorSpace::SetReferenceWhite(), and stira::imagedata::TransformColorSpace::sRGBtoXYZ().
bool stira::imagedata::Image::XYZToAdobeRGB | ( | ColorValue | referenceIlluminant = ColorConstants::sD65_XYZ | ) |
Converts image from XYZ color representation to AdobeRGB.
referenceIlluminant | reference illuminant (or white point) |
References stira::imagedata::TransformColorSpace::SetReferenceWhite(), and stira::imagedata::TransformColorSpace::XYZtoAdobeRGB().
bool stira::imagedata::Image::XYZTosRGB | ( | ColorValue | referenceIlluminant = ColorConstants::sD65_XYZ | ) |
Converts image from XYZ color representation to sRGB.
referenceIlluminant | reference illuminant (or white point) |
References stira::imagedata::TransformColorSpace::SetReferenceWhite(), and stira::imagedata::TransformColorSpace::XYZtosRGB().
bool stira::imagedata::Image::YUVToRGB | ( | ) |
Converts image from YUV color representation to RGB.
References stira::imagedata::TransformColorSpace::YUVtoRGB().