Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
b939b4ae
Commit
b939b4ae
authored
Feb 19, 2014
by
Rohit Girdhar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed inline, changed interface
parent
a879e1fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
26 deletions
+25
-26
types.hpp
modules/core/include/opencv2/core/types.hpp
+1
-26
matrix.cpp
modules/core/src/matrix.cpp
+24
-0
No files found.
modules/core/include/opencv2/core/types.hpp
View file @
b939b4ae
...
...
@@ -392,7 +392,7 @@ public:
//! various constructors
RotatedRect
();
RotatedRect
(
const
Point2f
&
center
,
const
Size2f
&
size
,
float
angle
);
RotatedRect
(
const
std
::
vector
<
Point2f
>&
points
);
RotatedRect
(
const
Point2f
&
point1
,
const
Point2f
&
point2
,
const
Point2f
&
point3
);
//! returns 4 vertices of the rectangle
void
points
(
Point2f
pts
[])
const
;
...
...
@@ -1548,31 +1548,6 @@ inline
RotatedRect
::
RotatedRect
(
const
Point2f
&
_center
,
const
Size2f
&
_size
,
float
_angle
)
:
center
(
_center
),
size
(
_size
),
angle
(
_angle
)
{}
inline
RotatedRect
::
RotatedRect
(
const
std
::
vector
<
Point2f
>&
_points
)
{
CV_Assert
(
_points
.
size
()
==
3
);
Point2f
_center
=
0.5
f
*
(
_points
[
0
]
+
_points
[
2
]);
Vec2f
vecs
[
2
];
vecs
[
0
]
=
Vec2f
(
_points
[
0
]
-
_points
[
1
]);
vecs
[
1
]
=
Vec2f
(
_points
[
1
]
-
_points
[
2
]);
// check that given sides are perpendicular
CV_Assert
(
abs
(
vecs
[
0
].
dot
(
vecs
[
1
]))
<=
0.001
);
// wd_i stores which vector (0,1) or (1,2) will make the width
// One of them will definitely have slope within -1 to 1
int
wd_i
=
0
;
if
(
vecs
[
1
][
0
]
!=
0
&&
fabs
(
vecs
[
1
][
1
]
/
vecs
[
1
][
0
])
<=
1.0
f
)
wd_i
=
1
;
int
ht_i
=
(
wd_i
+
1
)
%
2
;
float
_angle
=
atan
(
vecs
[
wd_i
][
1
]
/
vecs
[
wd_i
][
0
])
*
180.0
f
/
(
float
)
CV_PI
;
float
_width
=
(
float
)
norm
(
vecs
[
wd_i
]);
float
_height
=
(
float
)
norm
(
vecs
[
ht_i
]);
center
=
_center
;
size
=
Size2f
(
_width
,
_height
);
angle
=
_angle
;
}
///////////////////////////////// Range /////////////////////////////////
...
...
modules/core/src/matrix.cpp
View file @
b939b4ae
...
...
@@ -5204,6 +5204,30 @@ void normalize( const SparseMat& src, SparseMat& dst, double a, int norm_type )
////////////////////// RotatedRect //////////////////////
RotatedRect
::
RotatedRect
(
const
Point2f
&
_point1
,
const
Point2f
&
_point2
,
const
Point2f
&
_point3
)
{
Point2f
_center
=
0.5
f
*
(
_point1
+
_point3
);
Vec2f
vecs
[
2
];
vecs
[
0
]
=
Vec2f
(
_point1
-
_point2
);
vecs
[
1
]
=
Vec2f
(
_point2
-
_point3
);
// check that given sides are perpendicular
CV_Assert
(
abs
(
vecs
[
0
].
dot
(
vecs
[
1
]))
<=
0.001
);
// wd_i stores which vector (0,1) or (1,2) will make the width
// One of them will definitely have slope within -1 to 1
int
wd_i
=
0
;
if
(
vecs
[
1
][
0
]
!=
0
&&
abs
(
vecs
[
1
][
1
]
/
vecs
[
1
][
0
])
<=
1.0
f
)
wd_i
=
1
;
int
ht_i
=
(
wd_i
+
1
)
%
2
;
float
_angle
=
atan
(
vecs
[
wd_i
][
1
]
/
vecs
[
wd_i
][
0
])
*
180.0
f
/
(
float
)
CV_PI
;
float
_width
=
(
float
)
norm
(
vecs
[
wd_i
]);
float
_height
=
(
float
)
norm
(
vecs
[
ht_i
]);
center
=
_center
;
size
=
Size2f
(
_width
,
_height
);
angle
=
_angle
;
}
void
RotatedRect
::
points
(
Point2f
pt
[])
const
{
double
_angle
=
angle
*
CV_PI
/
180.
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment