From 1e875612f3d807d0f8d75b624f2a18cc113d8928 Mon Sep 17 00:00:00 2001 From: anapt Date: Sun, 21 Jan 2018 23:21:10 +0200 Subject: [PATCH] without kernel --- meanshift.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/meanshift.c b/meanshift.c index 5679cd5..51e4b4f 100644 --- a/meanshift.c +++ b/meanshift.c @@ -12,6 +12,9 @@ char* LABELS_FILENAME = "data/L.bin"; struct timeval startwtime, endwtime; double seq_time; +int meanshift(double **original_points, double ***shifted_points, int h + , parameters *opt, int iteration); + int main(int argc, char **argv){ int h = 1; @@ -69,4 +72,123 @@ int main(int argc, char **argv){ //TODO write output points to file -> plot later //save_matrix(shifted_points, iterations); +} + +int meanshift(double **original_points, double ***shifted_points, int h + , parameters *opt, int iteration){ + + // allocates space and copies original points on first iteration + if (iteration == 1){ + (*shifted_points) = alloc_2d_double(NUMBER_OF_POINTS, DIMENSIONS); + duplicate(original_points, NUMBER_OF_POINTS, DIMENSIONS, shifted_points); + } + + // mean shift vector + double **mean_shift_vector; + mean_shift_vector = alloc_2d_double(NUMBER_OF_POINTS, DIMENSIONS); + // initialize elements of mean_shift_vector to inf + for (int i=0;i opt->epsilon) { + return meanshift(original_points, shifted_points, h, opt, ++iteration); + } + + return iteration; } \ No newline at end of file