Created
January 12, 2017 20:29
-
-
Save takahub1/105137da382466e2697b5d2302a3f80d to your computer and use it in GitHub Desktop.
g++ main.cpp -std=c++11 -o out `pkg-config opencv --cflags --libs`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <opencv2/opencv.hpp> | |
#include <random> | |
using namespace std; | |
using namespace cv; | |
int rand_(int range){ | |
std::random_device rnd; // 非決定的な乱数生成器 | |
return rnd()%range; | |
} | |
int main(void){ | |
for(int cnt=0;cnt<1000;cnt++){ | |
Mat image = Mat::zeros(500,500,CV_8UC3); | |
std::string fname = "rectangle_middle1/7_" + std::to_string(cnt) + ".jpg"; | |
for(int el=0;el<1;el++){ | |
Point pt1(100,100); | |
Point pt2(400,400); | |
// Point pt1(rand_(250),rand_(250)); | |
// Point pt2(250+rand_(250),250+rand_(250)); | |
rectangle(image,pt1,pt2,Scalar(rand_(200), rand_(200), rand_(200)), | |
3,8,0); | |
// Point center(250,250); | |
// ellipse(image, center, Size(rand_(200), rand_(200)), 0, 0, 360, | |
// Scalar(rand_(200), rand_(200), rand_(200)), -1, 8, 0); | |
} | |
imwrite(fname,image); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment