STIRA  0.1
Public Member Functions | Static Public Member Functions | List of all members
stira::imagetools::ImageTools Class Reference

Class with operations on image objects; Each of these operations creates a new image object that the caller becomes responsable for. More...

#include <ImageTools.h>

Public Member Functions

 ImageTools ()
 constructor
 
 ~ImageTools ()
 destructor
 

Static Public Member Functions

static Image * MirrorBorder (Image *pInImage, int borderWidth, int borderHeight)
 Creates from source image a new image with added mirrored borders The size of the border is borderWidth pixels left and right and borderHeight top and bottom. More...
 
static Image * CropBorder (Image *pInImage, int borderWidth, int borderHeight)
 Crops the image by cutting a border from around it of borderWidth pixels left and right and borderHeight top and bottom. More...
 
static Image * PaddBorder (Image *pInImage, int borderWidth, int borderHeight, double paddingValue)
 Creates from source image a new image with added padded borders The size of the border is borderWidth pixels left and right and borderHeight top and bottom. More...
 
static Image * ExtractSubImage (Image *pInImage, common::Point< int > topLeft, common::Point< int > bottomRight)
 Creates new subimage cropped from current image. More...
 
static bool InsertSubGrid (Image *pImage, ArrayGrid< double > *pSubGrid, int xTop, int yTop)
 overwrites part of an image with a subimage More...
 
static void Diagnose (Image *pImage, std::string ID=std::string(""))
 prints some image properties on std out for diagnostics More...
 
static Image * CreateImageSSD (Image *pImage1, Image *pImage2, bool printOutput=false)
 creates new difference image between two images (squared difference measure) More...
 
static double ComputeMSE (Image *pImage1, Image *pImage2)
 computes MSE (Mean Square Error) between two images More...
 
static double ComputePSNR (Image *pImage1, Image *pImage2)
 computes PSNR (Peak Signal to noise Ratio) between two images More...
 
static Image * CreateImageSSIM (Image *pImage1, Image *pImage2, int localWindowSize=9)
 creates new difference image between two images (Structural SIMilarity measure) More...
 
static std::vector< double > GetColorMappingFactors (Image *pImage1, Image *pImage2)
 help function to adjust global color perception of one image compared to another More...
 
static Image * CreateCheckeredImage (Image *pImage1, Image *pImage2, int blockSize=35)
 creates a new checkerboard image of the two input images Displays squares of size blockSize of alternating the first and the second image More...
 
static Image * CreateTransparantlyMixedImage (Image *pImage1, Image *pImage2, double thisWeight=0.5)
 creates a new transparant image from a weighted average of the two input images More...
 
static Image * ApplyGamma (Image *pInImage, double gamma)
 creates new image with adjusted gamma More...
 
static Image * CreateLinearRescaledImage (Image *pImage, bool bandsIndependent)
 creates a new linear rescaled image of an input image More...
 
static Image * ApplyJetColorMap (Image *pInImage)
 Creates a new image in false color using the "jet" color mapping This false color mapping for gray value images is well known from usage in Matlab. It ranges from blue for dark intensities to red for bright intensities, and passes through the colors cyan, yellow, and orange. More...
 
static Image * ConvertToGrayImage (Image *pInImage)
 Converts current image to gray image. More...
 
static Image * ConvertToSepiaImage (Image *pInImage)
 Converts current image to sepia-toned image. More...
 
static Image * Negative (Image *pInImage)
 Converts current image to its negative image Cfr photographic negative; each values is replaced by the maximum allowed value minus the current value. More...
 
static Image * Rotate90DegreesClockwise (Image *pInImage)
 Creates a new image: rotates input image 90 degrees clockwise. More...
 
static Image * Rotate90DegreesCounterClockwise (Image *pInImage)
 Creates a new image: rotates input image 90 degrees counterclockwise. More...
 
static Image * Rotate180Degrees (Image *pInImage)
 Creates a new image: rotates input image 180 degrees. More...
 
static double GetLocalDarkChannel (Image *pImage, int xLocalCenter, int yLocalCenter, int windowSize)
 determines the minimum value in a local window over all spectral bands More...
 
static unsigned int * CreateIntArrayFromColorImage (Image *pImage)
 creates an array of 32bit unsigned int values, where each int value combines the three color band values per pixel (each 8bit) in one 32bit value [ 0 0 0 0 0 0 0 0 0 ] [ 1 1 1 1 1 1 1 1 ] [ 1 1 1 1 1 1 1 1 ] [ 1 1 1 1 1 1 1 1 ] unused value R value G value B More...
 
static Image * CreateColorImageFromIntArray (unsigned int *pIntArray, int width, int height)
 creates an image from an array of 32bit integers by splitting again the integers in unsigned chars per band value More...
 

Detailed Description

Class with operations on image objects; Each of these operations creates a new image object that the caller becomes responsable for.

The methods in this class are grouped thematically in the following categories

Member Function Documentation

Image * stira::imagetools::ImageTools::ApplyGamma ( Image *  pInImage,
double  gamma 
)
static
Image * stira::imagetools::ImageTools::ApplyJetColorMap ( Image *  pInImage)
static

Creates a new image in false color using the "jet" color mapping This false color mapping for gray value images is well known from usage in Matlab. It ranges from blue for dark intensities to red for bright intensities, and passes through the colors cyan, yellow, and orange.

Returns
RGB image according to jet color map

References stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::common::MathUtils::GetMax(), stira::common::MathUtils::GetMin(), stira::imagedata::GridStatistics< T >::GetMinMax(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::ArrayGrid< T >::GetValue(), stira::imagedata::Image::GetWidth(), and stira::imagedata::Image::SetImageName().

double stira::imagetools::ImageTools::ComputeMSE ( Image *  pImage1,
Image *  pImage2 
)
static

computes MSE (Mean Square Error) between two images

Parameters
pImage1first image
pImage2second image
Returns
MSE value

References stira::imagetools::NumberGridTools< T >::ComputeMSE(), stira::imagedata::Image::GetBands(), and stira::imagedata::Image::GetNumberOfBands().

double stira::imagetools::ImageTools::ComputePSNR ( Image *  pImage1,
Image *  pImage2 
)
static

computes PSNR (Peak Signal to noise Ratio) between two images

Parameters
pImage1first image
pImage2second image
Returns
PSNR value
Image * stira::imagetools::ImageTools::ConvertToGrayImage ( Image *  pInImage)
static

Converts current image to gray image.

Parameters
pInImageinput image This is just the simplest possible technique; to be extended later with e.g., projection on a PCA basis

References stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetColor(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::Image::GetWidth(), stira::imagedata::TransformColorSpace::RGBToGray(), and stira::imagedata::Image::SetImageName().

Referenced by ConvertToSepiaImage().

Image * stira::imagetools::ImageTools::ConvertToSepiaImage ( Image *  pInImage)
static
Image * stira::imagetools::ImageTools::CreateCheckeredImage ( Image *  pImage1,
Image *  pImage2,
int  blockSize = 35 
)
static

creates a new checkerboard image of the two input images Displays squares of size blockSize of alternating the first and the second image

Parameters
pImage1first image
pImage2second image
blockSizesize of alternating blocks
Returns
checker board image; 0 if images have different dimensions or nr of bands

References stira::imagedata::Image::Clone(), stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetImageName(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::ArrayGrid< T >::GetValue(), stira::imagedata::Image::GetWidth(), stira::imagedata::Image::SetImageName(), and stira::imagedata::ArrayGrid< T >::SetValue().

Image * stira::imagetools::ImageTools::CreateColorImageFromIntArray ( unsigned int *  pIntArray,
int  width,
int  height 
)
static

creates an image from an array of 32bit integers by splitting again the integers in unsigned chars per band value

Parameters
pIntArraythe input array of 32bit integers
widththe width of the target image
heightthe height of the target image

References stira::imagedata::Image::SetColor(), and stira::common::MathUtils::SplitIntInChars().

Image * stira::imagetools::ImageTools::CreateImageSSD ( Image *  pImage1,
Image *  pImage2,
bool  printOutput = false 
)
static

creates new difference image between two images (squared difference measure)

Parameters
pImage1first image
pImage2second image
printOutputflag if output needs to be printed to console
Returns
image with visualization of squared difference

References stira::imagedata::Image::AddBand(), stira::imagetools::NumberGridTools< T >::CreateSquaredErrorGrid(), stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetImageName(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::Image::GetWidth(), and stira::imagedata::Image::SetImageName().

Image * stira::imagetools::ImageTools::CreateImageSSIM ( Image *  pImage1,
Image *  pImage2,
int  localWindowSize = 9 
)
static
unsigned int * stira::imagetools::ImageTools::CreateIntArrayFromColorImage ( Image *  pImage)
static

creates an array of 32bit unsigned int values, where each int value combines the three color band values per pixel (each 8bit) in one 32bit value [ 0 0 0 0 0 0 0 0 0 ] [ 1 1 1 1 1 1 1 1 ] [ 1 1 1 1 1 1 1 1 ] [ 1 1 1 1 1 1 1 1 ] unused value R value G value B

Parameters
pImageinput image, assumes that values per band internally can be cast to unsigned char

References stira::imagedata::ColorValue::c, stira::common::MathUtils::CombineCharsInInt(), stira::imagedata::Image::GetColor(), stira::imagedata::Image::GetHeight(), and stira::imagedata::Image::GetWidth().

Image * stira::imagetools::ImageTools::CreateLinearRescaledImage ( Image *  pImage,
bool  bandsIndependent 
)
static

creates a new linear rescaled image of an input image

Parameters
pImage1first image
pImage2second image
bandsIndependentflag if all bands are rescaled independant of each other
Returns
linearly rescaled image

References stira::imagedata::Image::Clone(), stira::imagedata::Image::GetBands(), stira::imagedata::GridStatistics< T >::GetMinMax(), and stira::imagedata::Image::GetNumberOfBands().

Image * stira::imagetools::ImageTools::CreateTransparantlyMixedImage ( Image *  pImage1,
Image *  pImage2,
double  thisWeight = 0.5 
)
static

creates a new transparant image from a weighted average of the two input images

Parameters
pImage1first image
pImage2second image
thisWeightweight for the current image (must be > 0 and < 1; else 0.5 is used)
Returns
transparant image; 0 if images have different dimensions or nr of bands

References stira::imagedata::Image::Clone(), stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetImageName(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::ArrayGrid< T >::GetValue(), stira::imagedata::Image::GetWidth(), stira::imagedata::Image::SetImageName(), and stira::imagedata::ArrayGrid< T >::SetValue().

Image * stira::imagetools::ImageTools::CropBorder ( Image *  pInImage,
int  borderWidth,
int  borderHeight 
)
static
void stira::imagetools::ImageTools::Diagnose ( Image *  pImage,
std::string  ID = std::string("") 
)
static
Image * stira::imagetools::ImageTools::ExtractSubImage ( Image *  pInImage,
common::Point< int >  topLeft,
common::Point< int >  bottomRight 
)
static

Creates new subimage cropped from current image.

Parameters
pInImageinput image
topLefttop left corner of region to crop
bottomRightbottom right corner of region to crop
Returns
new image (responsability of caller to delete) or 0 when mirroring couldn't be executed

References stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::Image::GetWidth(), stira::common::Point< T >::x, and stira::common::Point< T >::y.

std::vector< double > stira::imagetools::ImageTools::GetColorMappingFactors ( Image *  pImage1,
Image *  pImage2 
)
static

help function to adjust global color perception of one image compared to another

Parameters
pImage1reference image
pImage2image to compare with reference image
Returns
vector of ratios of color channel means

References stira::imagedata::Image::GetBands(), stira::imagedata::GridStatistics< T >::GetGridMean(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), and stira::imagedata::Image::GetWidth().

double stira::imagetools::ImageTools::GetLocalDarkChannel ( Image *  pImage,
int  xLocalCenter,
int  yLocalCenter,
int  windowSize 
)
static

determines the minimum value in a local window over all spectral bands

Parameters
pImageimage to investigate
xLocalCenterx coordinate of local patch under consideration
yLocalCentery coordinate of local patch under consideration
windowSizesize of local patches to take

References stira::imagedata::Image::GetBands(), stira::imagedata::GridStatistics< T >::GetLocalMinimum(), and stira::imagedata::Image::GetNumberOfBands().

Referenced by stira::contrastenhance::HazeRemover::Run(), and stira::contrastenhance::HazeRemover::~HazeRemover().

bool stira::imagetools::ImageTools::InsertSubGrid ( Image *  pImage,
ArrayGrid< double > *  pSubGrid,
int  xTop,
int  yTop 
)
static

overwrites part of an image with a subimage

Parameters
pSubGridgrid to insert
xTopx coordinate in parent image where to insert top left corner of sub image
yTopy coordinate in parent image where to insert top left corner of sub image

References stira::imagedata::ArrayGrid< T >::Clone(), stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::ArrayGrid< T >::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::ArrayGrid< T >::GetValue(), stira::imagedata::Image::GetWidth(), and stira::imagedata::ArrayGrid< T >::GetWidth().

Referenced by stira::imagetools::PyramidTools::VisualizeRealPyramid().

Image * stira::imagetools::ImageTools::MirrorBorder ( Image *  pInImage,
int  borderWidth,
int  borderHeight 
)
static

Creates from source image a new image with added mirrored borders The size of the border is borderWidth pixels left and right and borderHeight top and bottom.

Parameters
pInImageinput image
borderWidthwidth of the extra border left and right
borderHeightheight of the extra border top and bottom
Returns
new image (responsability of caller to delete) or 0 when mirroring couldn't be executed

References stira::imagedata::Image::AddBand(), stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::Image::GetWidth(), and stira::imagedata::GridExtender< T >::MirrorBorder().

Referenced by stira::filter::GaussConvolve::DerivativeConvolveFFT(), stira::fouriertools::FFT::GaussConvolve(), stira::filter::KuwaharaFilter::Run(), stira::filter::LaplacianOfGaussianFilter::Run(), stira::filter::AdaptiveBilateralFilter::Run(), stira::filter::NonLocalMeansFilter::Run(), stira::filter::LocalBinaryPattern::RunClassic(), stira::filter::MedianFilter::RunHybridMedian(), and stira::filter::MedianFilter::RunMedian().

Image * stira::imagetools::ImageTools::Negative ( Image *  pInImage)
static

Converts current image to its negative image Cfr photographic negative; each values is replaced by the maximum allowed value minus the current value.

Parameters
pInImageinput image

References stira::imagedata::Image::Clone(), stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::ArrayGrid< T >::GetValue(), stira::imagedata::Image::GetWidth(), and stira::imagedata::ArrayGrid< T >::SetValue().

Image * stira::imagetools::ImageTools::PaddBorder ( Image *  pInImage,
int  borderWidth,
int  borderHeight,
double  paddingValue 
)
static

Creates from source image a new image with added padded borders The size of the border is borderWidth pixels left and right and borderHeight top and bottom.

Parameters
pInImageinput image
borderWidthwidth of the extra border left and right
borderHeightheight of the extra border top and bottom
paddingValuevalue to be used for padding
Returns
new image (responsability of caller to delete) or 0 when mirroring couldn't be executed

References stira::imagedata::Image::AddBand(), stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::Image::GetWidth(), and stira::imagedata::GridExtender< T >::PaddBorder().

Referenced by stira::filter::GaussConvolve::DerivativeConvolveFFT().

Image * stira::imagetools::ImageTools::Rotate180Degrees ( Image *  pInImage)
static
Image * stira::imagetools::ImageTools::Rotate90DegreesClockwise ( Image *  pInImage)
static

Creates a new image: rotates input image 90 degrees clockwise.

Parameters
pInImageinput image
Returns
new rotated image (responsability of caller to delete)

References stira::imagedata::Image::AddBand(), stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::Image::GetWidth(), and stira::imagetools::NumberGridTools< T >::Rotate90DegreesClockwise().

Image * stira::imagetools::ImageTools::Rotate90DegreesCounterClockwise ( Image *  pInImage)
static

Creates a new image: rotates input image 90 degrees counterclockwise.

Parameters
pInImageinput image
Returns
new rotated image (responsability of caller to delete)

References stira::imagedata::Image::AddBand(), stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::Image::GetWidth(), and stira::imagetools::NumberGridTools< T >::Rotate90DegreesCounterClockwise().


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