-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
44 lines (33 loc) · 1.14 KB
/
test.cpp
File metadata and controls
44 lines (33 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <opencv2/highgui.hpp>
#include <iostream>
#include <random>
#include "primitives.hpp"
#define w 255
void drawPics (void) {
cv::Mat image;
image = cv::imread("./pics/Vanessa.jpg" , CV_LOAD_IMAGE_COLOR);
if(! image.data ) {
std::cout << "Could not open or find the image" << std::endl ;
return;
}
cv::namedWindow( "Display window", cv::WINDOW_AUTOSIZE );
cv::imshow( "Display window", image );
cv::waitKey(0);
}
void drawRandomLines (void) {
char rand_window[] = "Draw Random Lines";
cv::Mat img ( w, w, CV_8UC1, cv::Scalar(255));
std::default_random_engine generator;
std::uniform_int_distribution<int> distribution(1,w);
auto dice = std::bind ( distribution, generator );
Line ln1 (cv::Point(dice(), dice()), cv::Point(dice(), dice()), cv::Scalar(119), dice());
Line ln2 (cv::Point(dice(), dice()), cv::Point(dice(), dice()), cv::Scalar(119), dice());
ln1.draw(img);
std::cout << "img = " << std::endl << ln1.p1 << std::endl;
cv::namedWindow(rand_window, cv::WINDOW_AUTOSIZE );
cv::imshow(rand_window, img);
cv::waitKey(0);
ln2.draw(img);
cv::imshow(rand_window, img);
cv::waitKey(0);
}