mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
Image filtering with averaging, mean or median
Functions | |
template<typename imageTout , typename imageTin > | |
int | mx::improc::meanSmooth (imageTout &imOut, const imageTin &imIn, int meanFullWidth, bool rejectMinMax=false) |
Smooth an image using the mean in a rectangular box, optionally rejecting the highest and lowest values. More... | |
template<typename imageTout , typename imageTin > | |
int | mx::improc::meanSmooth (imageTout &imOut, int &xMax, int &yMax, typename imageTout::Scalar &pMax, const imageTin &imIn, int meanFullWidth, bool rejectMinMax=false) |
Smooth an image using the mean in a rectangular box, optionally rejecting the highest and lowest values. Determines the location and value of the highest pixel. More... | |
template<typename imageTout , typename imageTin > | |
int | mx::improc::medianSmooth (imageTout &imOut, int &xMax, int &yMax, typename imageTout::Scalar &pMax, const imageTin &imIn, int medianFullWidth) |
Smooth an image using the median in a rectangular box. Also Determines the location and value of the highest pixel in the smoothed image. More... | |
template<typename imageTout , typename imageTin > | |
int | mx::improc::medianSmooth (imageTout &imOut, const imageTin &imIn, int medianFullWidth) |
Smooth an image using the median in a rectangular box. More... | |
int mx::improc::meanSmooth | ( | imageTout & | imOut, |
const imageTin & | imIn, | ||
int | meanFullWidth, | ||
bool | rejectMinMax = false |
||
) |
Smooth an image using the mean in a rectangular box, optionally rejecting the highest and lowest values.
Calculates the mean value in a rectangular box of imIn, of size meanFullSidth X meanFullWidth and stores it in the corresonding center pixel of imOut. Does not smooth the 0.5*meanFullwidth rows and columns of the input image, and the values of these pixels are not changed in imOut (i.e. you should 0 them before the call).
imOut is not re-allocated.
If rejectMinMax is true
then the minimum and maximum value in the box are not included in the mean. Rejection makes the algorithm somewhat slower, depending on box width.
imageTout | is an eigen-like image array |
imageTin | is an eigen-like image array |
[out] | imOut | the smoothed image. Not re-allocated, and the edge pixels are not modified. |
[in] | imIn | the image to smooth |
[in] | meanFullWidth | the full-width of the smoothing box |
[in] | rejectMinMax | whether or not to reject the min and max value. |
Definition at line 485 of file imageFilters.hpp.
int mx::improc::meanSmooth | ( | imageTout & | imOut, |
int & | xMax, | ||
int & | yMax, | ||
typename imageTout::Scalar & | pMax, | ||
const imageTin & | imIn, | ||
int | meanFullWidth, | ||
bool | rejectMinMax = false |
||
) |
Smooth an image using the mean in a rectangular box, optionally rejecting the highest and lowest values. Determines the location and value of the highest pixel.
Calculates the mean value in a rectangular box of imIn, of size meanFullSidth X meanFullWidth and stores it in the corresonding center pixel of imOut. Does not smooth the 0.5*meanFullwidth rows and columns of the input image, and the values of these pixels are not changed in imOut (i.e. you should 0 them before the call).
imOut is not re-allocated.
If rejectMinMax is true
then the minimum and maximum value in the box are not included in the mean. Rejection makes the somewhat slower, depending on box width.
This version also determines the location and value of the maximum pixel. This adds some overhead, maybe on the order of 10% slower than without.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
imageTout | is an eigen-like image array |
imageTin | is an eigen-like image array |
[out] | imOut | the smoothed image. Not re-allocated, and the edge pixels are not modified. |
[out] | xMax | the x-locatioin of the max pixel |
[out] | yMax | the y-locatioin of the max pixel |
[out] | pMax | the value of the max pixel |
[in] | imIn | the image to smooth |
[in] | meanFullWidth | the full-width of the smoothing box |
[in] | rejectMinMax | whether or not to reject the min and max value. |
Definition at line 566 of file imageFilters.hpp.
int mx::improc::medianSmooth | ( | imageTout & | imOut, |
const imageTin & | imIn, | ||
int | medianFullWidth | ||
) |
Smooth an image using the median in a rectangular box.
Calculates the median value in a rectangular box of imIn, of size medianFullSidth X medianFullWidth and stores it in the corresponding center pixel of imOut. Does not smooth the outer 0.5*medianFullwidth rows and columns of the input image, and the values of these pixels are not changed in imOut (i.e. you should 0 them before the call).
imOut is not re-allocated.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
imageTout | is an eigen-like image array |
imageTin | is an eigen-like image array |
[out] | imOut | the smoothed image. Not re-allocated, and the edge pixels are not modified. |
[in] | imIn | the image to smooth |
[in] | medianFullWidth | the full-width of the smoothing box |
Definition at line 722 of file imageFilters.hpp.
int mx::improc::medianSmooth | ( | imageTout & | imOut, |
int & | xMax, | ||
int & | yMax, | ||
typename imageTout::Scalar & | pMax, | ||
const imageTin & | imIn, | ||
int | medianFullWidth | ||
) |
Smooth an image using the median in a rectangular box. Also Determines the location and value of the highest pixel in the smoothed image.
Calculates the median value in a rectangular box of imIn, of size medianFullSidth X medianFullWidth and stores it in the corresonding center pixel of imOut. Does not smooth the 0.5*medianFullwidth rows and columns of the input image, and the values of these pixels are not changed in imOut (i.e. you should 0 them before the call).
imOut is not re-allocated.
Also determines the location and value of the maximum pixel. This is a negligble overhead compared to the median operation.
imageTout | is an eigen-like image array |
imageTin | is an eigen-like image array |
[out] | imOut | the smoothed image. Not re-allocated, and the edge pixels are not modified. |
[out] | xMax | the x-locatioin of the max pixel |
[out] | yMax | the y-locatioin of the max pixel |
[out] | pMax | the value of the max pixel |
[in] | imIn | the image to smooth |
[in] | medianFullWidth | the full-width of the smoothing box |
Definition at line 661 of file imageFilters.hpp.
References mx::math::vectorMedianInPlace().
Referenced by mx::improc::HCIobservation< _realT >::preProcess().