Johannes Stricker
Johannes Stricker

Reputation: 1781

c++ opencv randu function throws 'Integer division by zero'

I'm trying to fill a cv::Mat with random numbers.

cv::Mat mat(100, 100, CV_8UC4);
cv::randu(mat, cv::Scalar(0), cv::Scalar(256));

The above code works fine, as long as I keep the scalars exactly as they are. Changing 0 and 256 to any other values will cause an Integer division by zero exception on the call to randu. Can anyone explain to me why? I'm using opencv3.

Upvotes: 0

Views: 344

Answers (1)

Alexander
Alexander

Reputation: 758

it looks like a bug in opencv<3.4.

please update to the latest opencv (you can still stay with opencv3)

Upvotes: 1

Related Questions