|
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. | |
| 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. | |
| template<typename imageTout, typename imageTin> | |
| int | mx::improc::medianSmooth (imageTout &imOut, int &xMax, int &yMax, typename imageTout::Scalar &pMax, const imageTin &imIn, int medianFullWidth) |
| 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. | |
| 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 meanFullWidth X meanFullWidth and stores it in the corresponding center pixel of imOut. For even widths, the window is associated with the higher-index member of the central pair: it contains meanFullWidth/2 pixels before the output pixel and one fewer after it. Pixels without a complete window are not changed in imOut (i.e. you should initialize 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 to reject the minimum and maximum values |
Definition at line 778 of file imageFilters.hpp.
Referenced by unitTest::improcTest::imageFiltersTest::TEST_CASE().
| 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 meanFullWidth X meanFullWidth and stores it in the corresponding center pixel of imOut. For even widths, the window is associated with the higher-index member of the central pair: it contains meanFullWidth/2 pixels before the output pixel and one fewer after it. Pixels without a complete window are not changed in imOut (i.e. you should initialize 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 location of the maximum pixel |
| [out] | yMax | the y location of the maximum pixel |
| [out] | pMax | the value of the maximum pixel |
| [in] | imIn | the image to smooth |
| [in] | meanFullWidth | the full width of the smoothing box |
| [in] | rejectMinMax | whether to reject the minimum and maximum values |
Definition at line 877 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 medianFullWidth X medianFullWidth and stores it in the corresponding center pixel of imOut. Even widths use the higher-index member of the central pair as the output pixel. Pixels without a complete window are not changed in imOut (i.e. you should initialize 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 1062 of file imageFilters.hpp.
References medianSmooth().
| 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 medianFullWidth X medianFullWidth and stores it in the corresponding center pixel of imOut. For even widths, the window is associated with the higher-index member of the central pair: it contains medianFullWidth/2 pixels before the output pixel and one fewer after it. The median of an even-sized window is the arithmetic mean of its two central samples. Pixels without a complete window are not changed in imOut (i.e. you should initialize 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 location of the maximum pixel |
| [out] | yMax | the y location of the maximum pixel |
| [out] | pMax | the value of the maximum pixel |
| [in] | imIn | the image to smooth |
| [in] | medianFullWidth | the full width of the smoothing box |
Definition at line 991 of file imageFilters.hpp.
References mx::math::vectorMedianInPlace().
Referenced by medianSmooth(), unitTest::improcTest::imageFiltersTest::TEST_CASE(), and unitTest::improcTest::imageFiltersTest::TEST_CASE().