aboutsummaryrefslogtreecommitdiff
path: root/pdp_opencv_hist_compare.c
diff options
context:
space:
mode:
authorN.N. <sevyves@users.sourceforge.net>2009-08-29 19:00:56 +0000
committerN.N. <sevyves@users.sourceforge.net>2009-08-29 19:00:56 +0000
commita49c186ec709e7edc3013de538f07e7d36d76266 (patch)
tree6652929967ea064ab8f861586e044147546df1f6 /pdp_opencv_hist_compare.c
parent1a20f9a54e86a5b9b96f595f094419cc7cc3dc7f (diff)
output all data
svn path=/trunk/externals/pdp_opencv/; revision=12135
Diffstat (limited to 'pdp_opencv_hist_compare.c')
-rw-r--r--pdp_opencv_hist_compare.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/pdp_opencv_hist_compare.c b/pdp_opencv_hist_compare.c
index adf3779..42fe6a4 100644
--- a/pdp_opencv_hist_compare.c
+++ b/pdp_opencv_hist_compare.c
@@ -165,13 +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[x->nbsaved];
- t_atom datalist[x->nbsaved];
+ double tato[MAX_HISTOGRAMS_TO_COMPARE];
+ t_atom datalist[MAX_HISTOGRAMS_TO_COMPARE];
int nearest = -1;
double max = 0;
int n;
- for (n=0; n<x->nbsaved; n++) {
+ if ( x->nbsaved > 0 )
+ for (n=0; n<MAX_HISTOGRAMS_TO_COMPARE; n++) {
tato[n] = cvCompareHist(x->hist, x->saved_hist[n], CV_COMP_INTERSECT);
SETFLOAT(&datalist[n], tato[n]);
if (tato[n]>max) {
@@ -182,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, x->nbsaved , datalist );
+ outlet_list( x->x_dataout, 0, MAX_HISTOGRAMS_TO_COMPARE, datalist );
} else
outlet_float(x->x_outlet1, -1.0);