-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobjectTypes.cpp
More file actions
74 lines (53 loc) · 1.4 KB
/
objectTypes.cpp
File metadata and controls
74 lines (53 loc) · 1.4 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>
#include <opencv2/core.hpp>
using namespace std;
using namespace cv;
Vec<double, 19> myVector;
typedef Vec<uchar, 2> Vec2b;
typedef Vec<uchar, 3> Vec3b;
typedef Vec<int, 2> Vec2i;
typedef Vec<int, 3> Vec3i;
typedef Vec<float, 2> Vec2f;
typedef Vec<float, 3> Vec3f;
typedef Vec<double, 2> Vec2d;
typedef Vec<double, 3> Vec3d;
typedef Point_<int> Point2i;
typedef Point2i Point;
typedef Point_<float> Point2f;
typedef Point_<double> Point2d;
int main() {
Vec2i v2 = {2, 2};
Vec2i v3 = {1, 2};
Vec2i sum = v2 + v3;
cout << sum << endl;
Vec3i v4 = {2, 2, 1};
Vec3i v5 = {1, 2, 4};
Vec3i sum2 = v4 + v5;
cout << sum2 << endl;
Vec3f v6 = {2, 2, 1, 0};
Vec3f v7 = {1, 2, 4, 7};
Vec3f sum3 = v6 + v7;
cout << sum3 << endl;
Vec3d v8 = {2.5, 2.1, 1.9};
Vec3d v9 = {1.5, 2.8, 9.0};
Vec3d sum4 = v8 + v9;
cout << sum4 << endl;
cout << "\nScalar object: " << endl;
Scalar s0(0);
Scalar s1(0.0, 1.0, 2.0, 3.0);
Scalar s2(s1);
cout << s0 << endl;
cout << s1 << endl;
cout << s2 << endl;
Scalar s_sum = s1 + s2;
cout << s_sum << endl;
cout << s_sum[0] << endl;
cout << s_sum[1] << endl;
cout << s_sum[2] << endl;
cout << s_sum[3] << endl;
cout << "\nPoint object: " << endl;
Point2i p21 = {1, 2};
Point2i p22 = {3, 4};
Point2i p2_sum = p21 + p22;
cout << p2_sum << endl;
}