1 | initial version |
I think the problem can be the mask
object's size.
I guess the number of rows of mask
is ok, but the number of columns is zero. You can check it by printing mask.cols
and mask.rows
. So you may have something like this: cv::Mat mask(100,0,CV_...
That would explains why it fails when summing over columns, but not when summing over rows.
Anyway, I have just noticed that the ouput of cv::reduce cannot be of type uint8_t
, since it has not enough capacity to store the whole sums. So, for instance, the output needs to be of type int
or larger for an input of type uint8_t
.
2 | No.2 Revision |
I think the problem can be the size of mask
object's size..
I guess the number of rows of mask
is ok, but the number of columns is zero. You can check it by printing mask.cols
and mask.rows
. So you may have erroneously initialized it with something like this: cv::Mat mask(100,0,CV_...
That would explains why it fails when summing over columns, but not when summing over rows.
Anyway, I have just noticed that the ouput of cv::reduce cannot be of type uint8_t
, since it has not enough capacity to store the whole sums. So, for instance, the output needs to be of type int
or larger for an input of type uint8_t
.