mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
Declares and defines functions to work with image masks. More...
Declares and defines functions to work with image masks.
Definition in file imageMasks.hpp.
#include "../math/constants.hpp"
#include "../math/geo.hpp"
#include "eigenImage.hpp"
#include "imageTransforms.hpp"
Go to the source code of this file.
Namespaces | |
namespace | mx |
The mxlib c++ namespace. | |
Functions | |
template<class eigenT > | |
void | mx::improc::radiusImage (eigenT &m, typename eigenT::Scalar xc, typename eigenT::Scalar yc, typename eigenT::Scalar scale=1) |
Fills in the cells of an Eigen 2D Array with their radius from the center. | |
template<class eigenT > | |
void | mx::improc::radiusImage (eigenT &m, typename eigenT::Scalar scale=1) |
Fills in the cells of Eigen-like 2D Array with their radius from the canonical center. | |
template<class angleT , class eigenT > | |
void | mx::improc::angleImage (eigenT &m, typename angleT::realT xc, typename angleT::realT yc) |
Fills in the cells of an Eigen-like 2D Array with their angle relative to the center. | |
template<class angleT , class eigenT > | |
void | mx::improc::angleImage (eigenT &m) |
Fills in the cells of Eigen 2D Array with their angle relative the canonical center. | |
template<class angleT , class eigenT1 , class eigenT2 > | |
void | mx::improc::radAngImage (eigenT1 &rIm, eigenT2 &qIm, typename angleT::realT xc, typename angleT::realT yc, typename angleT::realT rscale=1) |
Fills in the cells of Eigen-like arrays with their radius amd angle relative to the center. | |
template<typename vecT , typename angleT , typename eigenT1 , typename eigenT2 , typename eigenT3 = eigenT1> | |
vecT | mx::improc::annulusCoordsWorker (const eigenT1 &rIm, const eigenT2 &qIm, typename angleT::realT xcen, typename angleT::realT ycen, typename angleT::realT min_r, typename angleT::realT max_r, typename angleT::realT min_q, typename angleT::realT max_q, eigenT3 *mask=0, typename angleT::realT pixbuf=0) |
Get the coordinates of an annular region in an image. | |
template<typename angleT , typename eigenT1 , typename eigenT2 , typename eigenT3 = eigenT1> | |
std::vector< std::vector< int > > | mx::improc::annulusCoords (const eigenT1 &rIm, const eigenT2 &qIm, typename angleT::realT xcen, typename angleT::realT ycen, typename angleT::realT min_r, typename angleT::realT max_r, typename angleT::realT min_q, typename angleT::realT max_q, eigenT3 *mask=0, typename angleT::realT pixbuf=0) |
Get the array coordinates of an annular region in an image. | |
template<typename angleT , typename eigenT1 , typename eigenT2 , typename eigenT3 = eigenT1> | |
std::vector< size_t > | mx::improc::annulusIndices (const eigenT1 &rIm, const eigenT2 &qIm, typename angleT::realT xcen, typename angleT::realT ycen, typename angleT::realT min_r, typename angleT::realT max_r, typename angleT::realT min_q, typename angleT::realT max_q, eigenT3 *mask=0, typename angleT::realT pixbuf=0) |
Get the vector indices of an annular region in an image. | |
template<typename angleT > | |
void | mx::improc::annulusBoundingRect (int &x0, int &y0, int &x1, int &y1, typename angleT::realT xcen, typename angleT::realT ycen, typename angleT::realT min_r, typename angleT::realT max_r, typename angleT::realT min_q, typename angleT::realT max_q, typename angleT::realT pixbuf=0) |
Get the coordinates of the bounding rectangle of an annulus. | |
template<typename realT > | |
std::vector< size_t > | mx::improc::reflectImageIndices (const std::vector< size_t > &idxi, int w, int h, realT xc, realT yc) |
Reflect vector indices across the given center pixel. | |
template<class eigenT > | |
void | mx::improc::applyMask (eigenT &maskedIm, const std::vector< size_t > &idx, typename eigenT::Scalar maskval) |
Apply a mask to an image. | |
template<class eigenT > | |
void | mx::improc::applyMask (eigenT &maskedIm, const std::vector< std::vector< int > > &coord, typename eigenT::Scalar maskval) |
Apply a mask to an image. | |
template<class arrayT > | |
void | mx::improc::maskCircle (arrayT &m, typename arrayT::Scalar xcen, typename arrayT::Scalar ycen, typename arrayT::Scalar rad, typename arrayT::Scalar val, typename arrayT::Scalar pixbuf=0.5) |
Mask a circle in an image. | |
template<class arrayT > | |
void | mx::improc::maskCircle (arrayT &m, typename arrayT::Scalar rad, typename arrayT::Scalar val, typename arrayT::Scalar pixbuf=0.5) |
Mask a circle in an image at the standard center. | |
template<class arrayT > | |
void | mx::improc::maskEllipse (arrayT &m, typename arrayT::Scalar xcen, typename arrayT::Scalar ycen, typename arrayT::Scalar xrad, typename arrayT::Scalar yrad, typename arrayT::Scalar ang, typename arrayT::Scalar val=0, typename arrayT::Scalar pixbuf=0.5) |
Mask an ellipse in an image. | |
template<class arrayT > | |
void | mx::improc::maskWedge (arrayT &m, typename arrayT::Scalar xcen, typename arrayT::Scalar ycen, typename arrayT::Scalar angCen, typename arrayT::Scalar angHW, typename arrayT::Scalar val=0) |
Mask a wedge in an image. | |
template<typename realT > | |
int | mx::improc::drawLine (eigenImage< realT > &mask, realT x0, realT y0, realT x1, realT y1, realT val) |
Draw a thin (1-pixel) line from one point to another. | |
template<typename realT > | |
int | mx::improc::drawLine (eigenImage< realT > &mask, realT x0, realT y0, realT x1, realT y1, realT width, realT val) |
Draw a thick line from one point to another. | |
template<typename imT > | |
int | mx::improc::ccdBleedMask (imT &im, typename imT::Scalar x0, typename imT::Scalar y0, typename imT::Scalar rad, typename imT::Scalar height, typename imT::Scalar lwidth, typename imT::Scalar rwidth) |
Populate a mask based on a typical CCD bleeding pattern. | |
template<typename imageTout , typename imageTin > | |
void | mx::improc::cutImageRegion (imageTout &imout, const imageTin &imin, const std::vector< size_t > &idx, bool resize=true) |
Cut out a region of an image specified by an index-mask. | |
template<typename imageTout , typename imageTin > | |
void | mx::improc::insertImageRegion (imageTout imout, const imageTin &imin, const std::vector< size_t > &idx) |
Insert a region of an image specified by an index-mask. | |
template<typename imageT , typename transformT = cubicConvolTransform<typename imageT::Scalar>> | |
void | mx::improc::rotateMask (imageT &rotMask, imageT &mask, typename imageT::Scalar angle) |
Rotate a binary mask. | |
std::vector< size_t > mx::improc::reflectImageIndices | ( | const std::vector< size_t > & | idxi, |
int | w, | ||
int | h, | ||
realT | xc, | ||
realT | yc | ||
) |
Reflect vector indices across the given center pixel.
This assumes column major order.
[in] | idxi | the vector indices to reflect |
[in] | w | the image width |
[in] | h | the image height |
[in] | xc | the image center x coordinate |
[in] | yc | the image center y coordinate |
Definition at line 447 of file imageMasks.hpp.
References mx::improc::reflectImageCoords(), and mx::improc::reflectImageIndices().
Referenced by mx::improc::reflectImageIndices().
void mx::improc::rotateMask | ( | imageT & | rotMask, |
imageT & | mask, | ||
typename imageT::Scalar | angle | ||
) |
Rotate a binary mask.
Sets edge pixels to 0 or 1 depending on the interpolation, being below/above 0.5.
Definition at line 1009 of file imageMasks.hpp.
References mx::improc::imageRotate(), and mx::improc::rotateMask().
Referenced by mx::improc::rotateMask().