aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorN.N. <sevyves@users.sourceforge.net>2009-08-30 20:34:04 +0000
committerN.N. <sevyves@users.sourceforge.net>2009-08-30 20:34:04 +0000
commit8e5cfbbfa11d5c368c624176d64f26813be8a50a (patch)
tree3786d01da9414a6985da5624c17df952c47792c4
parentdaf3f96e32d547a762ed904b876865bc46c9104d (diff)
prevent unitialized histograms
svn path=/trunk/externals/pdp_opencv/; revision=12147
-rw-r--r--pdp_opencv_hist_compare.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pdp_opencv_hist_compare.c b/pdp_opencv_hist_compare.c
index 42fe6a4..e08c7be 100644
--- a/pdp_opencv_hist_compare.c
+++ b/pdp_opencv_hist_compare.c
@@ -165,14 +165,14 @@ static void pdp_opencv_hist_compare_process_rgb(t_pdp_opencv_hist_compare *x)
cvCalcHist( x->planes, x->hist, 0, 0 ); //Compute histogram
cvNormalizeHist( x->hist, 1.0 ); //Normalize it
- double tato[MAX_HISTOGRAMS_TO_COMPARE];
- t_atom datalist[MAX_HISTOGRAMS_TO_COMPARE];
+ double tato[x->nbsaved];
+ t_atom datalist[x->nbsaved];
int nearest = -1;
double max = 0;
int n;
if ( x->nbsaved > 0 )
- for (n=0; n<MAX_HISTOGRAMS_TO_COMPARE; n++) {
+ for (n=0; n<x->nbsaved; n++) {
tato[n] = cvCompareHist(x->hist, x->saved_hist[n], CV_COMP_INTERSECT);
SETFLOAT(&datalist[n], tato[n]);
if (tato[n]>max) {
@@ -183,7 +183,7 @@ static void pdp_opencv_hist_compare_process_rgb(t_pdp_opencv_hist_compare *x)
if ( x->nbsaved > 0 ) {
outlet_float(x->x_outlet1, (float)nearest);
- outlet_list( x->x_dataout, 0, MAX_HISTOGRAMS_TO_COMPARE, datalist );
+ outlet_list( x->x_dataout, 0, x->nbsaved, datalist );
} else
outlet_float(x->x_outlet1, -1.0);