diff --git a/src/dsp.c b/src/dsp.c index ef6ae91..c567863 100755 --- a/src/dsp.c +++ b/src/dsp.c @@ -238,9 +238,9 @@ int getpixelrow(float *pixelv, int nrow, int *zenith, int reset) { lcorr = fir(&pixelv[2], Sync, SyncFilterLen - 2); FreqLine = 1.0+((ecorr-lcorr) / corr / PixelLine / 4.0); - // Find the point in which ecorr and lcorr intercept - if(fabs(lcorr - ecorr) < minDoppler && fabs(fabs(lcorr - ecorr) - previous) < 10){ - minDoppler = fabs(lcorr - ecorr); + double val = fabs(lcorr - ecorr)*0.25 + previous*0.75; + if(val < minDoppler && nrow > 10){ + minDoppler = val; *zenith = nrow; } previous = fabs(lcorr - ecorr); diff --git a/src/image.c b/src/image.c index 5c5f5bf..05fb2a4 100644 --- a/src/image.c +++ b/src/image.c @@ -279,7 +279,7 @@ void flipImage(image_t *img, int width, int offset){ } // Calculate crop to reomve noise from the start and end of an image -void cropNoise(image_t *img){ +int cropNoise(image_t *img){ #define NOISE_THRESH 180.0 // Average value of minute marker @@ -324,6 +324,8 @@ void cropNoise(image_t *img){ // Ignore the noisy rows at the end img->nrow = (endCrop - startCrop); + + return startCrop; } // --- Temperature Calibration --- // diff --git a/src/image.h b/src/image.h index 7397a8d..2fb7e8d 100644 --- a/src/image.h +++ b/src/image.h @@ -5,5 +5,5 @@ void linearEnhance(float **prow, int nrow, int offset, int width); int calibrate(float **prow, int nrow, int offset, int width) ; void denoise(float **prow, int nrow, int offset, int width); void flipImage(image_t *img, int width, int offset); -void cropNoise(image_t *img); +int cropNoise(image_t *img); void temperature(options_t *opts, image_t *img, int offset, int width); diff --git a/src/main.c b/src/main.c index 38b6525..6c9143d 100644 --- a/src/main.c +++ b/src/main.c @@ -178,7 +178,7 @@ static int processAudio(char *filename, options_t *opts){ // Crop noise from start and end of image if(CONTAINS(opts->effects, Crop_Noise)){ - cropNoise(&img); + img.zenith -= cropNoise(&img); } // Denoise