Wavelets replace edge-preserving blur in first stage filtering. Much improved performance for about the same time cost; memory still an issue.

This commit is contained in:
Emil Martinec
2012-02-08 23:47:31 -06:00
parent 163098df71
commit c492509175
10 changed files with 1442 additions and 719 deletions

View File

@@ -37,9 +37,7 @@ void ImProcFunctions::impulse_nr (LabImage* lab, double thresh) {
int width = lab->W;
int height = lab->H;
float hpfabs, hfnbrave;
// buffer for the lowpass image
float ** lpf = new float *[height];
// buffer for the highpass image
@@ -77,10 +75,10 @@ void ImProcFunctions::impulse_nr (LabImage* lab, double thresh) {
for (int i=0; i < height; i++)
for (int j=0; j < width; j++) {
hpfabs = fabs(lab->L[i][j]-lpf[i][j]);
float hfnbrave = 0;
float hpfabs = fabs(lab->L[i][j]-lpf[i][j]);
//block average of high pass data
for (i1=MAX(0,i-2), hfnbrave=0; i1<=MIN(i+2,height-1); i1++ )
for (i1=MAX(0,i-2); i1<=MIN(i+2,height-1); i1++ )
for (j1=MAX(0,j-2); j1<=MIN(j+2,width-1); j1++ ) {
hfnbrave += fabs(lab->L[i1][j1]-lpf[i1][j1]);
}
@@ -94,7 +92,7 @@ void ImProcFunctions::impulse_nr (LabImage* lab, double thresh) {
if (!impish[i][j]) continue;
norm=0.0;
wtdsum[0]=wtdsum[1]=wtdsum[2]=0.0;
for (i1=MAX(0,i-2), hfnbrave=0; i1<=MIN(i+2,height-1); i1++ )
for (i1=MAX(0,i-2); i1<=MIN(i+2,height-1); i1++ )
for (j1=MAX(0,j-2); j1<=MIN(j+2,width-1); j1++ ) {
if (i1==i && j1==j) continue;
if (impish[i1][j1]) continue;