answered Nov 2 '12
change gg type to CV_32SC1:
gg
CV_32SC1
cv::Mat gg(cv::Mat::zeros::(1,5,CV_32SC1));
cv::reduce for SUM and 8U input can return only 32S, 32F or 64F types.