using opencv's, c language based api, need calculate sum of elements in opencv array. use sum(1) method. below have tried.
/* rgb1 opencv array */ cvscalar cvsum( const cvarr* rgb1); printf("%lf", cvscalar.val); but compiler error error: expected primary-expression before ‘.’ token.
'val' is array of doubles. need access via val[0], , printf using %f
you have bug. wrote in not valid c code.
should this:
cvscalar sum = cvsum(rgb1); printf("%f", sum.val[0]); or if don't want variable:
printf("%f", cvsum(rgb1).val[0]);
Comments
Post a Comment