Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sq975
openpose
提交
4faace17
O
openpose
项目概览
sq975
/
openpose
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openpose
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
4faace17
编写于
6月 13, 2020
作者:
G
Gines Hidalgo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
90 and 270 rotations working again #1586
上级
9433792b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
39 addition
and
6 deletion
+39
-6
doc/release_notes.md
doc/release_notes.md
+1
-0
include/openpose/core/matrix.hpp
include/openpose/core/matrix.hpp
+5
-0
include/openpose/utilities/openCv.hpp
include/openpose/utilities/openCv.hpp
+3
-1
src/openpose/core/matrix.cpp
src/openpose/core/matrix.cpp
+13
-0
src/openpose/utilities/openCv.cpp
src/openpose/utilities/openCv.cpp
+17
-5
未找到文件。
doc/release_notes.md
浏览文件 @
4faace17
...
...
@@ -418,6 +418,7 @@ OpenPose Library - Release Notes
1.
Main improvements:
2.
Functions or parameters renamed:
3.
Main bugs fixed:
1.
90 and 270-degree rotations working again.
4.
Changes/additions that affect the compatibility with the OpenPose Unity Plugin:
...
...
include/openpose/core/matrix.hpp
浏览文件 @
4faace17
...
...
@@ -112,6 +112,11 @@ namespace op
*/
explicit
Matrix
(
const
void
*
cvMatPtr
);
/**
* Analog to cv::Mat(int rows, int cols, int type, void *data, size_t step=AUTO_STEP)
*/
explicit
Matrix
(
const
int
rows
,
const
int
cols
,
const
int
type
);
/**
* Analog to cv::Mat(int rows, int cols, int type, void *data, size_t step=AUTO_STEP)
* Very important: This Matrix will only "borrow" this pointer, so the caller must make sure to maintain the
...
...
include/openpose/utilities/openCv.hpp
浏览文件 @
4faace17
...
...
@@ -13,13 +13,15 @@ namespace op
OP_API
void
keepRoiInside
(
Rectangle
<
int
>&
roi
,
const
int
imageWidth
,
const
int
imageHeight
);
OP_API
void
transpose
(
Matrix
&
matrix
);
/**
* It performs rotation and flipping over the desired Mat.
* @param cvMat Mat with the frame matrix to be rotated and/or flipped.
* @param rotationAngle How much the cvMat element should be rotated. 0 would mean no rotation.
* @param flipFrame Whether to flip the cvMat element. Set to false to disable it.
*/
OP_API
void
rotateAndFlipFrame
(
Matrix
&
cvMat
,
const
double
rotationAngle
,
const
bool
flipFrame
=
false
);
OP_API
void
rotateAndFlipFrame
(
Matrix
&
frame
,
const
double
rotationAngle
,
const
bool
flipFrame
=
false
);
/**
* Wrapper of CV_CAP_PROP_FRAME_COUNT to avoid leaving OpenCV dependencies on headers.
...
...
src/openpose/core/matrix.cpp
浏览文件 @
4faace17
...
...
@@ -54,6 +54,19 @@ namespace op
}
}
Matrix
::
Matrix
(
const
int
rows
,
const
int
cols
,
const
int
type
)
:
spImpl
{
std
::
make_shared
<
ImplMatrix
>
()}
{
try
{
spImpl
->
mCvMat
=
cv
::
Mat
(
rows
,
cols
,
type
);
}
catch
(
const
std
::
exception
&
e
)
{
error
(
e
.
what
(),
__LINE__
,
__FUNCTION__
,
__FILE__
);
}
}
Matrix
::
Matrix
(
const
int
rows
,
const
int
cols
,
const
int
type
,
void
*
cvMatPtr
)
:
spImpl
{
std
::
make_shared
<
ImplMatrix
>
()}
{
...
...
src/openpose/utilities/openCv.cpp
浏览文件 @
4faace17
...
...
@@ -224,14 +224,28 @@ namespace op
}
}
void
transpose
(
Matrix
&
matrix
)
{
cv
::
Mat
cvMatrix
=
OP_OP2CVMAT
(
matrix
);
Matrix
matrixFinal
(
matrix
.
cols
(),
matrix
.
rows
(),
matrix
.
type
());
cv
::
Mat
cvMatrixFinal
=
OP_OP2CVMAT
(
matrixFinal
);
cv
::
transpose
(
cvMatrix
,
cvMatrixFinal
);
std
::
swap
(
matrix
,
matrixFinal
);
}
void
rotateAndFlipFrame
(
Matrix
&
frame
,
const
double
rotationAngle
,
const
bool
flipFrame
)
{
try
{
cv
::
Mat
cvMatFrame
=
OP_OP2CVMAT
(
frame
);
if
(
!
cvMatF
rame
.
empty
())
// cv::flip() does not moidify the memory location of the cv::Mat, but cv::transpose does
if
(
!
f
rame
.
empty
())
{
const
auto
rotationAngleInt
=
(
int
)
std
::
round
(
rotationAngle
)
%
360
;
// Transposing
if
(
rotationAngleInt
==
90
||
rotationAngleInt
==
270
||
rotationAngleInt
==
-
90
||
rotationAngleInt
==
-
270
)
transpose
(
frame
);
// Mirroring (flipping)
cv
::
Mat
cvMatFrame
=
OP_OP2CVMAT
(
frame
);
if
(
rotationAngleInt
==
0
||
rotationAngleInt
==
360
)
{
if
(
flipFrame
)
...
...
@@ -239,7 +253,6 @@ namespace op
}
else
if
(
rotationAngleInt
==
90
||
rotationAngleInt
==
-
270
)
{
cv
::
transpose
(
cvMatFrame
,
cvMatFrame
);
if
(
!
flipFrame
)
cv
::
flip
(
cvMatFrame
,
cvMatFrame
,
0
);
}
...
...
@@ -252,7 +265,6 @@ namespace op
}
else
if
(
rotationAngleInt
==
270
||
rotationAngleInt
==
-
90
)
{
cv
::
transpose
(
cvMatFrame
,
cvMatFrame
);
if
(
flipFrame
)
cv
::
flip
(
cvMatFrame
,
cvMatFrame
,
-
1
);
else
...
...
@@ -260,7 +272,7 @@ namespace op
}
else
error
(
"Rotation angle = "
+
std
::
to_string
(
rotationAngleInt
)
+
" != {0, 90, 180, 270} degrees."
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
+
" != {0, 90, 180, 270} degrees."
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
}
}
catch
(
const
std
::
exception
&
e
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录