STIRA
0.1
|
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... | |
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
creates new image with adjusted gamma
pInImage | input image |
gamma | gamma factor to apply |
References stira::imagedata::Image::Clone(), stira::common::MathUtils::GammaCorrect(), 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().
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.
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().
computes MSE (Mean Square Error) between two images
pImage1 | first image |
pImage2 | second image |
References stira::imagetools::NumberGridTools< T >::ComputeMSE(), stira::imagedata::Image::GetBands(), and stira::imagedata::Image::GetNumberOfBands().
computes PSNR (Peak Signal to noise Ratio) between two images
pImage1 | first image |
pImage2 | second image |
Converts current image to gray image.
pInImage | input 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().
Converts current image to sepia-toned image.
pInImage | input image |
References ConvertToGrayImage(), stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::Image::GetWidth(), stira::imagedata::TransformColorSpace::RGBToSepia2(), stira::imagedata::Image::SetColor(), and stira::imagedata::Image::SetImageName().
|
static |
creates a new checkerboard image of the two input images Displays squares of size blockSize of alternating the first and the second image
pImage1 | first image |
pImage2 | second image |
blockSize | size of alternating blocks |
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().
|
static |
creates an image from an array of 32bit integers by splitting again the integers in unsigned chars per band value
pIntArray | the input array of 32bit integers |
width | the width of the target image |
height | the height of the target image |
References stira::imagedata::Image::SetColor(), and stira::common::MathUtils::SplitIntInChars().
|
static |
creates new difference image between two images (squared difference measure)
pImage1 | first image |
pImage2 | second image |
printOutput | flag if output needs to be printed to console |
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().
|
static |
creates new difference image between two images (Structural SIMilarity measure)
pImage1 | first image |
pImage2 | second image |
References stira::imagedata::Image::AddBand(), stira::imagetools::NumberGridTools< T >::ComputeSSIM(), stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetImageName(), stira::imagedata::GridStatistics< T >::GetMinMax(), stira::imagedata::Image::GetNumberOfBands(), stira::imagedata::Image::GetWidth(), and stira::imagedata::Image::SetImageName().
|
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
pImage | input 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().
|
static |
creates a new linear rescaled image of an input image
pImage1 | first image |
pImage2 | second image |
bandsIndependent | flag if all bands are rescaled independant of each other |
References stira::imagedata::Image::Clone(), stira::imagedata::Image::GetBands(), stira::imagedata::GridStatistics< T >::GetMinMax(), and stira::imagedata::Image::GetNumberOfBands().
|
static |
creates a new transparant image from a weighted average of the two input images
pImage1 | first image |
pImage2 | second image |
thisWeight | weight for the current image (must be > 0 and < 1; else 0.5 is used) |
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().
|
static |
Crops the image by cutting a border from around it of borderWidth pixels left and right and borderHeight top and bottom.
pInImage | input image |
borderWidth | width of the extra border left and right |
borderHeight | height of the extra border top and bottom |
References stira::imagedata::Image::AddBand(), stira::imagedata::GridExtender< T >::CropBorder(), stira::imagedata::Image::GetBands(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), and stira::imagedata::Image::GetWidth().
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().
|
static |
prints some image properties on std out for diagnostics
ID | identifier which image is being diagnosed |
References stira::imagedata::Image::GetBands(), stira::imagedata::GridStatistics< T >::GetGridKurtosis(), stira::imagedata::GridStatistics< T >::GetGridMean(), stira::imagedata::GridStatistics< T >::GetGridVariance(), stira::imagedata::Image::GetHeight(), stira::imagedata::GridStatistics< T >::GetMinMax(), stira::imagedata::Image::GetNumberOfBands(), and stira::imagedata::Image::GetWidth().
|
static |
Creates new subimage cropped from current image.
pInImage | input image |
topLeft | top left corner of region to crop |
bottomRight | bottom right corner of region to crop |
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.
|
static |
help function to adjust global color perception of one image compared to another
pImage1 | reference image |
pImage2 | image to compare with reference image |
References stira::imagedata::Image::GetBands(), stira::imagedata::GridStatistics< T >::GetGridMean(), stira::imagedata::Image::GetHeight(), stira::imagedata::Image::GetNumberOfBands(), and stira::imagedata::Image::GetWidth().
|
static |
determines the minimum value in a local window over all spectral bands
pImage | image to investigate |
xLocalCenter | x coordinate of local patch under consideration |
yLocalCenter | y coordinate of local patch under consideration |
windowSize | size 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().
|
static |
overwrites part of an image with a subimage
pSubGrid | grid 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 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().
|
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.
pInImage | input image |
borderWidth | width of the extra border left and right |
borderHeight | height of the extra border top and bottom |
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().
Converts current image to its negative image Cfr photographic negative; each values is replaced by the maximum allowed value minus the current value.
pInImage | input 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().
|
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.
pInImage | input image |
borderWidth | width of the extra border left and right |
borderHeight | height of the extra border top and bottom |
paddingValue | value to be used for padding |
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().
Creates a new image: rotates input image 180 degrees.
pInImage | input 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 >::Rotate180Degrees().
Creates a new image: rotates input image 90 degrees clockwise.
pInImage | input image |
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().
Creates a new image: rotates input image 90 degrees counterclockwise.
pInImage | input image |
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().