19 #include <nori/rfilter.h>
32 m_radius = propList.
getFloat(
"radius", 2.0f);
34 m_stddev = propList.
getFloat(
"stddev", 0.5f);
37 float eval(
float x)
const {
38 float alpha = -1.0f / (2.0f * m_stddev*m_stddev);
40 std::exp(alpha * x * x) -
41 std::exp(alpha * m_radius * m_radius));
44 virtual std::string
toString()
const override {
45 return tfm::format(
"GaussianFilter[radius=%f, stddev=%f]", m_radius, m_stddev);
61 m_radius = propList.
getFloat(
"radius", 2.0f);
63 m_B = propList.
getFloat(
"B", 1.0f / 3.0f);
65 m_C = propList.
getFloat(
"C", 1.0f / 3.0f);
68 float eval(
float x)
const {
69 x = std::abs(2.0f * x / m_radius);
70 float x2 = x*x, x3 = x2*x;
73 return 1.0f/6.0f * ((12-9*m_B-6*m_C)*x3
74 + (-18+12*m_B+6*m_C) * x2 + (6-2*m_B));
76 return 1.0f/6.0f * ((-m_B-6*m_C)*x3 + (6*m_B+30*m_C) * x2
77 + (-12*m_B-48*m_C)*x + (8*m_B + 24*m_C));
83 virtual std::string
toString()
const override {
84 return tfm::format(
"MitchellNetravaliFilter[radius=%f, B=%f, C=%f]", m_radius, m_B, m_C);
97 float eval(
float x)
const {
98 return std::max(0.0f, 1.0f - std::abs(x));
102 return "TentFilter[]";
118 return "BoxFilter[]";
Box filter – fastest, but prone to aliasing.
virtual std::string toString() const override
Return a brief string summary of the instance (for debugging purposes)
float eval(float) const
Evaluate the filter function.
float eval(float x) const
Evaluate the filter function.
virtual std::string toString() const override
Return a brief string summary of the instance (for debugging purposes)
float eval(float x) const
Evaluate the filter function.
virtual std::string toString() const override
Return a brief string summary of the instance (for debugging purposes)
This is an associative container used to supply the constructors of NoriObject subclasses with parame...
float getFloat(const std::string &name) const
Get a float property, and throw an exception if it does not exist.
Generic radially symmetric image reconstruction filter.
virtual std::string toString() const override
Return a brief string summary of the instance (for debugging purposes)
float eval(float x) const
Evaluate the filter function.