Add SCIE-Lab error metric. Work in progress.
This commit is contained in:
parent
5cf219a22e
commit
1f1afe0c33
@ -7,6 +7,7 @@ SET(IMAGE_SRCS
|
|||||||
DirectDrawSurface.h DirectDrawSurface.cpp
|
DirectDrawSurface.h DirectDrawSurface.cpp
|
||||||
Filter.h Filter.cpp
|
Filter.h Filter.cpp
|
||||||
FloatImage.h FloatImage.cpp
|
FloatImage.h FloatImage.cpp
|
||||||
|
ErrorMetric.h ErrorMetric.cpp
|
||||||
Image.h Image.cpp
|
Image.h Image.cpp
|
||||||
ImageIO.h ImageIO.cpp
|
ImageIO.h ImageIO.cpp
|
||||||
NormalMap.h NormalMap.cpp
|
NormalMap.h NormalMap.cpp
|
||||||
|
@ -265,6 +265,19 @@ void KaiserFilter::setParameters(float alpha, float stretch)
|
|||||||
this->stretch = stretch;
|
this->stretch = stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GaussianFilter::GaussianFilter(float w) : Filter(w) { setParameters(1); }
|
||||||
|
|
||||||
|
float GaussianFilter::evaluate(float x) const
|
||||||
|
{
|
||||||
|
// variance = sigma^2
|
||||||
|
return (1.0f / sqrtf(2 * PI * variance)) * expf(-x*x / (2 * variance));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GaussianFilter::setParameters(float variance)
|
||||||
|
{
|
||||||
|
this->variance = variance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Ctor.
|
/// Ctor.
|
||||||
|
@ -116,6 +116,19 @@ namespace nv
|
|||||||
float stretch;
|
float stretch;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Gaussian filter.
|
||||||
|
class GaussianFilter : public Filter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GaussianFilter(float w);
|
||||||
|
virtual float evaluate(float x) const;
|
||||||
|
|
||||||
|
void setParameters(float variance);
|
||||||
|
|
||||||
|
private:
|
||||||
|
float variance;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// A 1D kernel. Used to precompute filter weights.
|
/// A 1D kernel. Used to precompute filter weights.
|
||||||
|
@ -178,10 +178,10 @@ namespace nv
|
|||||||
|
|
||||||
inline float perceptualColorDistance(Vector3::Arg c0, Vector3::Arg c1)
|
inline float perceptualColorDistance(Vector3::Arg c0, Vector3::Arg c1)
|
||||||
{
|
{
|
||||||
float rmean = (c0.r + c1.r) * 0.5f;
|
float rmean = (c0.x + c1.x) * 0.5f;
|
||||||
float r = c1.r - c0.r;
|
float r = c1.x - c0.x;
|
||||||
float g = c1.g - c0.g;
|
float g = c1.y - c0.y;
|
||||||
float b = c1.b - c0.b;
|
float b = c1.z - c0.z;
|
||||||
return sqrtf((2 + rmean)*r*r + 4*g*g + (3 - rmean)*b*b);
|
return sqrtf((2 + rmean)*r*r + 4*g*g + (3 - rmean)*b*b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user