1 | #include <iostream>
|
2 |
|
3 | #include <opencv/cv.h>
|
4 | #include <opencv/highgui.h>
|
5 |
|
6 | using namespace std;
|
7 | using namespace cv;
|
8 |
|
9 | int
|
10 | main(int argc, char** argv)
|
11 | {
|
12 | const int rows = 256;
|
13 | const int cols = 256;
|
14 |
|
15 | Mat img(rows, cols, CV_8UC1, Scalar(255));
|
16 |
|
17 | line(img, Point(0, 10), Point(255, 10), Scalar(0), 2, 4);
|
18 | line(img, Point(-5, 20), Point(260, 20), Scalar(0), 2, 4);
|
19 |
|
20 | line(img, Point(10, 0), Point(10, 255), Scalar(0), 2, 4);
|
21 |
|
22 | float x0 = 0.0/pow(2.0, -2.0);
|
23 | float x1 = 255.0/pow(2.0, -2.0);
|
24 | float y = 30.5/pow(2.0, -2.0);
|
25 |
|
26 | line(img, Point(int(x0), int(y)), Point(int(x1), int(y)),
|
27 | Scalar(0), 2, 4, 2);
|
28 |
|
29 | cerr << "saving linetest.png...\n";
|
30 | imwrite("linetest.png", img);
|
31 |
|
32 | return 0;
|
33 | }
|