aboutsummaryrefslogtreecommitdiff
path: root/src/itrans-threshold.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/itrans-threshold.c')
-rw-r--r--src/itrans-threshold.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/itrans-threshold.c b/src/itrans-threshold.c
index 30e476c..17a2cbe 100644
--- a/src/itrans-threshold.c
+++ b/src/itrans-threshold.c
@@ -16,17 +16,17 @@
#include <stdint.h>
#include <assert.h>
-#include "control.h"
-#include "imagedisplay.h"
-#include "reflections.h"
+#include "image.h"
-unsigned int itrans_peaksearch_threshold(ImageRecord *imagerecord, ControlContext *ctx) {
+ImageFeatureList *itrans_peaksearch_threshold(ImageRecord *imagerecord, ControlContext *ctx) {
int width, height;
int x, y;
- unsigned int n_reflections = 0;
uint16_t *image = imagerecord->image;
uint16_t max = 0;
+ ImageFeatureList *flist;
+
+ flist = image_feature_list_new();
width = imagerecord->width;
height = imagerecord->height;
@@ -45,25 +45,25 @@ unsigned int itrans_peaksearch_threshold(ImageRecord *imagerecord, ControlContex
assert(y<height);
assert(x>=0);
assert(y>=0);
- reflection_add_from_dp(ctx, (x-imagerecord->x_centre), (y-imagerecord->y_centre),
- imagerecord, image[x + width*y]);
- n_reflections++;
+ image_add_feature(flist, (x-imagerecord->x_centre), (y-imagerecord->y_centre), imagerecord, image[x + width*y]);
}
}
}
- return n_reflections;
+ return flist;
}
-unsigned int itrans_peaksearch_adaptive_threshold(ImageRecord *imagerecord, ControlContext *ctx) {
+ImageFeatureList *itrans_peaksearch_adaptive_threshold(ImageRecord *imagerecord, ControlContext *ctx) {
uint16_t max_val = 0;
int width, height;
- unsigned int n_reflections = 0;
uint16_t *image;
uint16_t max;
int x, y;
+ ImageFeatureList *flist;
+
+ flist = image_feature_list_new();
image = imagerecord->image;
width = imagerecord->width;
@@ -100,9 +100,7 @@ unsigned int itrans_peaksearch_adaptive_threshold(ImageRecord *imagerecord, Cont
assert(max_y<height);
assert(max_x>=0);
assert(max_y>=0);
- reflection_add_from_dp(ctx, (max_x-imagerecord->x_centre), (max_y-imagerecord->y_centre),
- imagerecord, image[x + width*y]);
- n_reflections++;
+ image_add_feature(flist, (x-imagerecord->x_centre), (y-imagerecord->y_centre), imagerecord, image[x + width*y]);
/* Remove it and its surroundings */
for ( y=((max_y-10>0)?max_y-10:0); y<((max_y+10)<height?max_y+10:height); y++ ) {
@@ -114,7 +112,7 @@ unsigned int itrans_peaksearch_adaptive_threshold(ImageRecord *imagerecord, Cont
} while ( max_val > 50 );
- return n_reflections;
+ return flist;
}