1#ifndef MJR_INCLUDE_rcPixelFilters
34 namespace ramCanvasPixelFilter {
41 template<
class sourceT>
55 template<
class sourceT>
65 template<
class sourceT>
69 typedef typename sourceT::colorType::colConRGBbyte
colorType;
75 template<
class sourceT>
79 typedef typename sourceT::colorType::colConRGBAbyte
colorType;
85 template<
class sourceT>
89 typedef typename sourceT::colorType::colConRGBdbl
colorType;
95 template<
class sourceT>
99 typedef typename sourceT::colorType::colConRGBAdbl
colorType;
105 template<
class sourceT,
class outColorChanT>
119 template<
class sourceT,
class outColorT,
class colorScheme,
int chan = 0>
120 requires(std::same_as<outColorT,
decltype(colorScheme::c(1))> && (chan>=0) && (chan<outColorT::channelCount))
127 if constexpr (sourceT::colorType::chanIsInt) {
128 return colorScheme::c(
static_cast<outColorT::csIntType
>(mjr::math::linm::gen_map(
static_cast<sourceT::colorType::channelArithSDPType
>(
FixGeomBase<sourceT>::attachedRC.getPxColorNC(x, y).getChan(chan)),
129 static_cast<sourceT::colorType::channelArithSDPType
>(sourceT::colorType::minChanVal),
130 static_cast<sourceT::colorType::channelArithSDPType
>(sourceT::colorType::maxChanVal),
131 static_cast<sourceT::colorType::channelArithSDPType
>(0),
132 static_cast<sourceT::colorType::channelArithSDPType
>(colorScheme::numC - 1))));
142 template<
class sourceT,
class outColorT = sourceT::colorType>
145 typedef std::function<outColorT(
typename sourceT::colorType)>
ctf_t;
156 template<
class sourceT,
int factor>
170 colorType retColor(
static_cast<colorType::channelType
>(0));
171 for(
int c=0; c<colorType::channelCount; c++) {
172 typename colorType::channelArithSPType sum =
static_cast<colorType::channelArithSPType
>(0);
175 sum +=
attachedRC.getPxColorNC(xi+x0, yi+y0).getChanNC(c);
178 retColor.setChanNC(c,
static_cast<colorType::channelType
>(sum/factor/factor));
185 template<
class sourceT>
202#define MJR_INCLUDE_rcPixelFilters
Template Class used to house colors for ramCanvas objects.
static constexpr clrChanT maxChanVal
maximum value for a channel
Colorize by applying a color scheme to a single channel automatically mapping max channel value to ma...
sourceT::coordIntType coordIntType
colorType getPxColorNC(coordIntType x, coordIntType y)
ColorSchemeOnChan(sourceT &aRC)
An incomplete class (no getPxColorNC method) that provides a nice base for homogeniouss pixel filters...
bool isIntAxOrientationNaturalY()
FixGeomBase(sourceT &aRC)
bool isIntAxOrientationNaturalX()
coordIntType getNumPixX()
sourceT::coordIntType coordIntType
coordIntType getNumPixY()
sourceT::coordIntType coordIntType
colorType getPxColorNC(coordIntType x, coordIntType y)
sourceT::colorType colorType
Monochrome transformation using colorT::intensityScaled().
MonoIntensity(sourceT &aRC)
sourceT::coordIntType coordIntType
colorTpl< outColorChanT, 1 > colorType
colorType getPxColorNC(coordIntType x, coordIntType y)
Convert to an RGBA color image with 8-bit integer channels.
sourceT::colorType::colConRGBAbyte colorType
sourceT::coordIntType coordIntType
colorType getPxColorNC(coordIntType x, coordIntType y)
Convert to an RGBA color image with 64-bit floating point channels.
colorType getPxColorNC(coordIntType x, coordIntType y)
sourceT::colorType::colConRGBAdbl colorType
sourceT::coordIntType coordIntType
Convert to an RGB color image with 8-bit integer channels.
colorType getPxColorNC(coordIntType x, coordIntType y)
sourceT::colorType::colConRGBbyte colorType
sourceT::coordIntType coordIntType
Convert to an RGB color image with 64-bit floating point channels.
sourceT::coordIntType coordIntType
sourceT::colorType::colConRGBdbl colorType
colorType getPxColorNC(coordIntType x, coordIntType y)
Rotate image 90 degrees clockwise.
colorType getPxColorNC(coordIntType x, coordIntType y)
sourceT::colorType colorType
coordIntType getNumPixX()
bool isIntAxOrientationNaturalY()
coordIntType getNumPixY()
sourceT::coordIntType coordIntType
bool isIntAxOrientationNaturalX()
Scale down a canvis using a method similar to ramCanvasTpl::scaleDownMean().
colorType getPxColorNC(coordIntType x, coordIntType y)
bool isIntAxOrientationNaturalX()
ScaleDownMean(sourceT &aRC)
coordIntType getNumPixY()
coordIntType getNumPixX()
sourceT::coordIntType coordIntType
bool isIntAxOrientationNaturalY()
sourceT::colorType colorType