The cv::Mat setTo function is a member function of the cv::Mat class in OpenCV library. The function sets every element of the mat to a given value or an array of values. The function has three different parameters: the value that is to be set across all channels or the value for each channel in the case of a multichannel array, the optional mask for where to apply the setting, and the optional stream to be used for the operation.
Here are a few code examples using the setTo function:
Example 1: Setting all pixel values to 0 in a grayscale image
This code reads in an image in color, and sets all the pixel values to the color red.
Package Library: OpenCV
C++ (Cpp) Mat::setTo - 30 examples found. These are the top rated real world C++ (Cpp) examples of cv::Mat::setTo extracted from open source projects. You can rate examples to help us improve the quality of examples.