#include <opencv2/highgui/highgui.hpp>
int main (int argc, char** argv)
{
//初始化随机种子
//cv::RNG rng(cvGetTickCount());
cv::RNG rng(time(0));
cv::Mat image1(500,500,CV_8UC3,cv::Scalar(rng.uniform(0,255),rng.uniform(0,255),rng.uniform(0,255)));
cv::namedWindow("image 1");
imshow("image 1", image1);
cv::Mat image2(500,500,CV_32FC3,cv::Scalar(rng.uniform(0.0,1.0),rng.uniform(0.0,1.0),rng.uniform(0.0,1.0)));
cv::namedWindow("image 2");
imshow("image 2", image2);
cv::waitKey();
return 0;
}
opencv 随机颜色
最新推荐文章于 2024-08-16 15:31:19 发布