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

Useful functions for working with images

Classes

class  mx::improc::sourceFinder< _realT >
 Find stars in an image by SNR thresholding. More...
 

Functions

template<typename realT >
int mx::improc::circleOuterpix (realT &x0, realT &y0, realT &avgr0, realT &avgx, realT &avgy, realT &avgr, eigenImage< realT > &circ, const eigenImage< realT > &masked)
 Find the center and the outermost pixels of a circular mask, giving an estimate of the radius.
 

Function Documentation

◆ circleOuterpix()

template<typename realT >
int mx::improc::circleOuterpix ( realT &  x0,
realT &  y0,
realT &  avgr0,
realT &  avgx,
realT &  avgy,
realT &  avgr,
eigenImage< realT > &  circ,
const eigenImage< realT > &  masked 
)

Find the center and the outermost pixels of a circular mask, giving an estimate of the radius.

Takes a 1/0 mask of a filled circle or annulus, and calculates the center coordinate by center-of-light, then finds the outermost 1 pixel in each row and column. Calculates the average radius of these pixels w.r.t. to the c.o.l. coords, as well as w.r.t. the average coords of the outer pixels themselves.

Also produces an image containing the outer pixels.

Returns
0 on success
Template Parameters
realTthe real floating-point type for calculations
Parameters
y0< [out] x coord of center of the mask by center-of-light
avgr0< [out] y coord of center of the mask by center-of-light
avgx< [out] average radius of edge pixels w.r.t. center-of-light
avgy< [out] x coord of center of the mask by average edge pixel
avgr< [out] y coord of center of the mask by average edge pixel
circ< [out] average radius of edge pixels w.r.t. to average edge pixel
masked< [out] image showing the edge pixels with value 1, all other pixels 0. Resized. < [in] an image with a (roughly) circular mask of 1s

Definition at line 55 of file circleOuterpix.hpp.

References mx::improc::imageCenterOfLight().

◆ imcpy()

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.

This is merely memcpy

Returns
dest
Parameters
[out]destthe address of the first pixel in the destination image
[in]srcthe address of the first pixel in the source image
[in]widththe width in pixels of size szof
[in]heightthe height in pixels of size szof
[in]szofthe size in bytes of a one pixel

Definition at line 35 of file imageUtils.cpp.

◆ imcpy_flipLR()

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.

Returns
dest
Parameters
[out]destthe address of the first pixel in the destination image
[in]srcthe address of the first pixel in the source image
[in]widththe width in pixels of size szof
[in]heightthe height in pixels of size szof
[in]szofthe size in bytes of a one pixel

Definition at line 50 of file imageUtils.cpp.

◆ imcpy_flipUD()

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.

This is a reversed row-by-row memcpy

Returns
dest
Parameters
[out]destthe address of the first pixel in the destination image
[in]srcthe address of the first pixel in the source image
[in]widththe width in pixels of size szof
[in]heightthe height in pixels of size szof
[in]szofthe size in bytes of a one pixel

Definition at line 40 of file imageUtils.cpp.

◆ imcpy_flipUDLR()

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.

Returns
dest
Parameters
[out]destthe address of the first pixel in the destination image
[in]srcthe address of the first pixel in the source image
[in]widththe width in pixels of size szof
[in]heightthe height in pixels of size szof
[in]szofthe size in bytes of a one pixel

Definition at line 118 of file imageUtils.cpp.

◆ IsNan()

bool mx::improc::IsNan ( float  value)
inline

Check if the number is nan, using several different methods.

Definition at line 83 of file imageUtils.hpp.

Referenced by mx::improc::zeroNaNCube(), and mx::improc::zeroNaNs().

◆ reflectImageCoords()

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.

Parameters
[out]x1the reflected x coordinate
[out]y1the reflected y coordinate
[in]x0the input x coordinate
[in]y0the input y coordinate
[in]xcthe center pixel x coordinate
[in]ycthe center pixel y coordinate

Definition at line 93 of file imageUtils.hpp.

Referenced by mx::improc::reflectImageIndices().