Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How does cv::randu works on images

I was expecting a black image from the following code, but instead get a mix of black and white. Can someone explain what is hapenning?

int main(int argc, char *argv[]) {
    cv::Size image_size(1200,200);

    cv::Mat rectangle(image_size, CV_8UC3);

    cv::randu(rectangle, 0, 0);
    cv::imshow("rectangle", rectangle);
    cv::waitKey(0);
}