|
mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
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. | |
| 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. | |
| 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.
| realT | the real floating-point type for calculations |
| 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 imageCenterOfLight().
| 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
| [out] | dest | the address of the first pixel in the destination image |
| [in] | src | the address of the first pixel in the source image |
| [in] | width | the width in pixels of size szof |
| [in] | height | the height in pixels of size szof |
| [in] | szof | the size in bytes of a one pixel |
Definition at line 35 of file imageUtils.cpp.
| 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.
| [out] | dest | the address of the first pixel in the destination image |
| [in] | src | the address of the first pixel in the source image |
| [in] | width | the width in pixels of size szof |
| [in] | height | the height in pixels of size szof |
| [in] | szof | the size in bytes of a one pixel |
Definition at line 50 of file imageUtils.cpp.
| 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
| [out] | dest | the address of the first pixel in the destination image |
| [in] | src | the address of the first pixel in the source image |
| [in] | width | the width in pixels of size szof |
| [in] | height | the height in pixels of size szof |
| [in] | szof | the size in bytes of a one pixel |
Definition at line 40 of file imageUtils.cpp.
| 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.
| [out] | dest | the address of the first pixel in the destination image |
| [in] | src | the address of the first pixel in the source image |
| [in] | width | the width in pixels of size szof |
| [in] | height | the height in pixels of size szof |
| [in] | szof | the size in bytes of a one pixel |
Definition at line 118 of file imageUtils.cpp.
|
constexpr |
Return the configured invalid image-pixel value.
The default is a quiet NaN so FITS and image-display tools recognize invalid pixels. Defining MXLIB_INVALID_NUMBER_VALUE at compile time selects that finite value instead. CMake propagates its MXLIB_INVALID_NUMBER_VALUE cache setting through the installed pkg-config metadata.
Definition at line 85 of file imageUtils.hpp.
Referenced by isInvalidPixel(), mx::improc::eigenCube< dataT >::mean(), mx::improc::eigenCube< dataT >::mean(), mx::improc::eigenCube< dataT >::median(), mx::improc::eigenCube< dataT >::sigmaMean(), mx::improc::eigenCube< dataT >::sigmaMean(), and TEST_CASE().
| bool mx::improc::isInvalidPixel | ( | realT | value | ) |
Check whether a value represents an invalid image pixel.
Detects the configured mxlib invalid-number value as well as NaN and positive or negative infinity. The non-finite classification remains reliable under finite-math-only optimization.
| [in] | value | value to test |
Definition at line 103 of file imageUtils.hpp.
References invalidNumber(), and mx::math::isFinite().
Referenced by TEST_CASE(), unitTest::improcTest::eigenCubeTest::TEST_CASE(), unitTest::improcTest::eigenCubeTest::TEST_CASE(), unitTest::improcTest::eigenCubeTest::TEST_CASE(), zeroNaNCube(), and zeroNaNs().
| int mx::improc::reflectImageCoords | ( | int & | x1, |
| int & | y1, | ||
| int | x0, | ||
| int | y0, | ||
| realT | xc, | ||
| realT | yc ) |
Reflect pixel coordinates across the given center pixel.
| [out] | x1 | the reflected x coordinate |
| [out] | y1 | the reflected y coordinate |
| [in] | x0 | the input x coordinate |
| [in] | y0 | the input y coordinate |
| [in] | xc | the center pixel x coordinate |
| [in] | yc | the center pixel y coordinate |
Definition at line 118 of file imageUtils.hpp.
Referenced by reflectImageIndices().