mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
imageUtils.hpp File Reference

Header for the image processing utilities. More...

Header for the image processing utilities.

Author
Jared R. Males

Definition in file imageUtils.hpp.

#include <cmath>
#include <limits>
#include <type_traits>
#include "../math/floatUtils.hpp"
#include "imageTransforms.hpp"

Go to the source code of this file.

Namespaces

namespace  mx
 The mxlib c++ namespace.

Functions

template<typename realT = double>
realT mx::improc::imCen (int rows_cols)
 Get the mxlib standard center coordinate of an image.
template<typename realT = double, typename imT>
realT mx::improc::imCenX (const imT &im)
 Get the mxlib standard center x-coordinate of an image.
template<typename realT = double, typename imT>
realT mx::improc::imCenY (const imT &im)
 Get the mxlib standard center y-coordinate of an image.
template<class imageT, typename valueT>
void mx::improc::zeroNaNs (imageT &im, valueT val)
 Zero any NaNs in an image.
template<class imageT>
void mx::improc::zeroNaNs (imageT &im)
 Zero any NaNs in an image.
template<class cubeT, class maskCubeT>
void mx::improc::zeroNaNCube (cubeT &imc, maskCubeT *mask)
 Zero any NaNs in an image cube.
template<class cubeT>
void mx::improc::zeroNaNCube (cubeT &imc)
 Zero any NaNs in an image cube.
template<class calcT, class imageT>
calcT mx::improc::imageMean (imageT &im)
 Calculate the mean value of an image.
template<class calcT, class imageT, class maskT>
calcT mx::improc::imageMean (imageT &im, const maskT &mask)
 Calculate the mean value of an image over a mask.
template<typename calcT, class imageT>
calcT mx::improc::imageVariance (imageT &im, calcT mn)
 Calculate the variance of an image given its mean.
template<typename calcT, class imageT, class maskT>
calcT mx::improc::imageVariance (imageT &im, calcT mn, const maskT &mask)
 Calculate the variance of an image given its mean.
template<typename imageT, typename maskT = imageT>
imageT::Scalar mx::improc::imageMedian (const imageT &mat, const maskT *mask, std::vector< typename imageT::Scalar > *work=0)
 Calculate the median of an Eigen-like array.
template<typename imageT>
imageT::Scalar mx::improc::imageMedian (const imageT &mat, std::vector< typename imageT::Scalar > *work=0)
 Calculate the median of an Eigen-like array.
template<typename imageT>
int mx::improc::imageCenterOfLight (typename imageT::Scalar &x, typename imageT::Scalar &y, const imageT &im)
 Calculate the center of light of an image.
template<typename floatT, typename imageT, typename magImageT, typename transformT>
int mx::improc::imageMaxInterp (floatT &x, floatT &y, floatT &scale_x, floatT &scale_y, magImageT &magIm, const imageT &im, transformT trans)
 Find the maximum in an image at sub-pixel resolution by interpolation.
template<typename floatT, typename imageT, typename magImageT>
int mx::improc::imageMaxInterp (floatT &x, floatT &y, floatT &scale_x, floatT &scale_y, magImageT &magIm, const imageT &im)
 Find the maximum in an image at sub-pixel resolution by cubic convolution interpolation.
template<typename imageT, typename imageT1, typename imageT2, typename imageT3, typename imageT4>
void mx::improc::combine2ImagesMasked (imageT &combo, const imageT1 &im1, const imageT2 &mask1, const imageT3 &im2, const imageT4 &mask2)
 Combine two images, each with their own mask defining good pixels.
template<typename eigenT, typename eigenTin>
void mx::improc::removeRowsAndCols (eigenT &out, const eigenTin &in, int st, int w)
 Remove rows and columns.
template<typename eigenT, typename eigenTin>
void mx::improc::removeRows (eigenT &out, const eigenTin &in, int st, int w)
 Remove rows.
template<typename eigenT, typename eigenTin>
void mx::improc::removeCols (eigenT &out, const eigenTin &in, int st, int w)
 Remove columns.
template<typename realT>
constexpr realT mx::improc::invalidNumber ()
 Return the configured invalid image-pixel value.
template<typename realT>
bool mx::improc::isInvalidPixel (realT value)
 Check whether a value represents an invalid image pixel.
template<typename realT>
int mx::improc::reflectImageCoords (int &x1, int &y1, int x0, int y0, realT xc, realT yc)
 Reflect pixel coordinates across the given center pixel.
void * mx::improc::imcpy (void *dest, void *src, size_t width, size_t height, size_t szof)
 Copy one image to another, with no transformation.
void * mx::improc::imcpy_flipUD (void *dest, void *src, size_t width, size_t height, size_t szof)
 Copy one image to another, flipping up-down.
void * mx::improc::imcpy_flipLR (void *dest, void *src, size_t width, size_t height, size_t szof)
 Copy one image to another, flipping left-right.
void * mx::improc::imcpy_flipUDLR (void *dest, void *src, size_t width, size_t height, size_t szof)
 Copy one image to another, flipping up-down and left-right.

Function Documentation

◆ imCen()

template<typename realT = double>
realT mx::improc::imCen ( int rows_cols)

Get the mxlib standard center coordinate of an image.

Returns
0.5*(rows_cols-1)
Parameters
[in]rows_colsthe number of rows or columns in the image

Definition at line 48 of file imageUtils.hpp.

◆ imCenX()

template<typename realT = double, typename imT>
realT mx::improc::imCenX ( const imT & im)

Get the mxlib standard center x-coordinate of an image.

Returns
0.5*(rows-1)
Parameters
[in]imthe image to find the center of

Definition at line 58 of file imageUtils.hpp.

◆ imCenY()

template<typename realT = double, typename imT>
realT mx::improc::imCenY ( const imT & im)

Get the mxlib standard center y-coordinate of an image.

Returns
0.5*(cols-1)
Parameters
[in]imthe image to find the center of

Definition at line 68 of file imageUtils.hpp.