#include<opencv2/opencv.hpp> #include<iostream> #include <vector> int main(int argc, char** argv) { cv::Mat_<int>src(3, 3); cv::randu(src, cv::Scalar(0), cv::Scalar(255)); //返回均匀分布的随机数,填入数组或矩阵 //参数1:dst – 输出数组或矩阵 //参数2:low – 区间下界(闭区间) //参数3: high - 区间上界(开区间). std::cout << src << std::endl << std::endl; cv::Mat_<float>src1(3, 3); randn(src, 0, 1);//返回高斯分布的随机数,填入数组或矩阵 //参数1:dst – 输出数组或矩阵 //参数2:mean – 均值 //参数3: stddev - 标准差 std::cout << src1 << std::endl << std::endl; cv::waitKey(0); return 0; }