Test version of slow gauss for retinex
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "opthelper.h"
|
#include "opthelper.h"
|
||||||
|
#include "stdio.h"
|
||||||
// classical filtering if the support window is small:
|
// classical filtering if the support window is small:
|
||||||
|
|
||||||
template<class T> void gaussHorizontal3 (T** src, T** dst, int W, int H, const float c0, const float c1)
|
template<class T> void gaussHorizontal3 (T** src, T** dst, int W, int H, const float c0, const float c1)
|
||||||
@@ -765,22 +765,32 @@ template<class T> void gaussianBlur(T** src, T** dst, const int W, const int H,
|
|||||||
{
|
{
|
||||||
double newSigma = sigma;
|
double newSigma = sigma;
|
||||||
|
|
||||||
if(forceLowSigma) {
|
if(forceLowSigma && newSigma > 170.f) {
|
||||||
newSigma /= sqrt(2.0);
|
newSigma /= sqrt(2.0);
|
||||||
|
|
||||||
if(newSigma < 0.6) { // barrier to avoid using simple gauss version for higher radius
|
if(newSigma < 0.6) { // barrier to avoid using simple gauss version for higher radius
|
||||||
newSigma = sigma;
|
newSigma = sigma;
|
||||||
forceLowSigma = false;
|
forceLowSigma = false;
|
||||||
|
gaussianBlur(src,dst,W,H,newSigma,forceLowSigma);
|
||||||
|
} else {
|
||||||
|
gaussianBlur(src,dst,W,H,newSigma,forceLowSigma);
|
||||||
|
gaussianBlur(dst,dst,W,H,newSigma,forceLowSigma);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
gaussHorizontal<T> (src, dst, W, H, newSigma);
|
||||||
gaussHorizontal<T> (src, dst, W, H, newSigma);
|
|
||||||
gaussVertical<T> (dst, dst, W, H, newSigma);
|
|
||||||
|
|
||||||
if(forceLowSigma) {
|
|
||||||
gaussHorizontal<T> (dst, dst, W, H, newSigma);
|
|
||||||
gaussVertical<T> (dst, dst, W, H, newSigma);
|
gaussVertical<T> (dst, dst, W, H, newSigma);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// #pragma omp critical
|
||||||
|
// printf("gauss sigma : %f / %f\n",sigma,newSigma);
|
||||||
|
|
||||||
|
/*
|
||||||
|
if(forceLowSigma && newSigma > 170.f) {
|
||||||
|
gaussianBlur(dst,dst,W,H,newSigma,forceLowSigma);
|
||||||
|
// gaussHorizontal<T> (dst, dst, W, H, newSigma);
|
||||||
|
// gaussVertical<T> (dst, dst, W, H, newSigma);
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -44,6 +44,8 @@
|
|||||||
#include "rawimagesource.h"
|
#include "rawimagesource.h"
|
||||||
#include "improcfun.h"
|
#include "improcfun.h"
|
||||||
#include "opthelper.h"
|
#include "opthelper.h"
|
||||||
|
#include "StopWatch.h"
|
||||||
|
|
||||||
#define MAX_RETINEX_SCALES 8
|
#define MAX_RETINEX_SCALES 8
|
||||||
#define clipretinex( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val )
|
#define clipretinex( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val )
|
||||||
|
|
||||||
@@ -98,6 +100,9 @@ void retinex_scales( float* scales, int nscales, int mode, int s, float high)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for ( int i = 0; i < nscales; ++i )
|
||||||
|
printf("sigma[%d] : %f\n",i,scales[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
void mean_stddv2( float **dst, float &mean, float &stddv, int W_L, int H_L, float &maxtr, float &mintr)
|
void mean_stddv2( float **dst, float &mean, float &stddv, int W_L, int H_L, float &maxtr, float &mintr)
|
||||||
{
|
{
|
||||||
@@ -205,6 +210,7 @@ void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L, const
|
|||||||
|
|
||||||
void RawImageSource::MSR(float** luminance, float** originalLuminance, float **exLuminance, int width, int height, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax)
|
void RawImageSource::MSR(float** luminance, float** originalLuminance, float **exLuminance, int width, int height, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax)
|
||||||
{
|
{
|
||||||
|
StopWatch Stop1("MSR");
|
||||||
if (deh.enabled) {//enabled
|
if (deh.enabled) {//enabled
|
||||||
float mean, stddv, maxtr, mintr;
|
float mean, stddv, maxtr, mintr;
|
||||||
// float mini, delta, maxi;
|
// float mini, delta, maxi;
|
||||||
|
Reference in New Issue
Block a user