Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
ca6fabf4
P
PaddleOCR
项目概览
PaddlePaddle
/
PaddleOCR
大约 1 年 前同步成功
通知
1528
Star
32962
Fork
6643
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
108
列表
看板
标记
里程碑
合并请求
7
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
108
Issue
108
列表
看板
标记
里程碑
合并请求
7
合并请求
7
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ca6fabf4
编写于
7月 22, 2021
作者:
锦鲤AI幸运
🎯
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
在菜单edit和鼠标右键 增加图片左右旋转功能 且有标注框的情况下不可以旋转,优化代码
上级
4df7ada9
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
9707 addition
and
13073 deletion
+9707
-13073
PPOCRLabel/PPOCRLabel.py
PPOCRLabel/PPOCRLabel.py
+30
-27
PPOCRLabel/libs/resources.py
PPOCRLabel/libs/resources.py
+9677
-13046
未找到文件。
PPOCRLabel/PPOCRLabel.py
浏览文件 @
ca6fabf4
...
@@ -31,7 +31,7 @@ import cv2
...
@@ -31,7 +31,7 @@ import cv2
__dir__
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
__dir__
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
import
numpy
as
np
import
numpy
as
np
from
labelme
import
LabelFile
sys
.
path
.
append
(
__dir__
)
sys
.
path
.
append
(
__dir__
)
sys
.
path
.
append
(
os
.
path
.
abspath
(
os
.
path
.
join
(
__dir__
,
'../..'
)))
sys
.
path
.
append
(
os
.
path
.
abspath
(
os
.
path
.
join
(
__dir__
,
'../..'
)))
...
@@ -795,47 +795,50 @@ class MainWindow(QMainWindow, WindowMixin):
...
@@ -795,47 +795,50 @@ class MainWindow(QMainWindow, WindowMixin):
self
.
actions
.
create
.
setEnabled
(
False
)
self
.
actions
.
create
.
setEnabled
(
False
)
self
.
actions
.
undoLastPoint
.
setEnabled
(
True
)
self
.
actions
.
undoLastPoint
.
setEnabled
(
True
)
def
rotateImg
(
self
,
filename
,
k
,
_value
):
self
.
actions
.
rotateRight
.
setEnabled
(
_value
)
pix
=
cv2
.
imread
(
filename
)
pix
=
np
.
rot90
(
pix
,
k
)
cv2
.
imwrite
(
filename
,
pix
)
self
.
canvas
.
update
()
self
.
loadFile
(
filename
)
def
rotateImgWarn
(
self
):
if
self
.
lang
==
'ch'
:
self
.
msgBox
.
warning
(
self
,
"提示"
,
"
\n
该图片已经有标注框,旋转操作会打乱标注,建议清除标注框后旋转。"
)
else
:
self
.
msgBox
.
warning
(
self
,
"Warn"
,
"
\n
The picture already has a label box, and rotation will disrupt the label.
\
It is recommended to clear the label box and rotate it."
)
def
rotateLeftImg
(
self
,
_value
=
False
):
def
rotateLeftImg
(
self
,
_value
=
False
):
filename
=
self
.
mImgList
[
self
.
currIndex
]
filename
=
self
.
mImgList
[
self
.
currIndex
]
if
os
.
path
.
exists
(
filename
):
if
os
.
path
.
exists
(
filename
):
_value
=
True
if
self
.
itemsToShapesbox
:
self
.
actions
.
rotateLeft
.
setEnabled
(
_value
)
self
.
rotateImgWarn
()
pix
=
cv2
.
imread
(
filename
)
else
:
pix
=
np
.
rot90
(
pix
,
k
=
1
)
_value
=
True
cv2
.
imwrite
(
filename
,
pix
)
self
.
rotateImg
(
filename
=
filename
,
k
=
1
,
_value
=
_value
)
self
.
canvas
.
update
()
self
.
loadFile
(
filename
)
else
:
else
:
_value
=
False
_value
=
False
if
self
.
lang
==
'ch'
:
self
.
rotateImgWarn
()
self
.
msgBox
.
warning
(
self
,
"提示"
,
"
\n
请从图片列表选择一个需要旋转的图片,且确保图片存在!"
)
self
.
actions
.
rotateRight
.
setEnabled
(
_value
)
else
:
self
.
msgBox
.
warning
(
self
,
"Warn"
,
"
\n
Please select an image from the list of images to rotate and make sure the image exists!"
)
self
.
actions
.
rotateLeft
.
setEnabled
(
_value
)
def
rotateRightImg
(
self
,
_value
=
False
):
def
rotateRightImg
(
self
,
_value
=
False
):
filename
=
self
.
mImgList
[
self
.
currIndex
]
filename
=
self
.
mImgList
[
self
.
currIndex
]
if
os
.
path
.
exists
(
filename
):
if
os
.
path
.
exists
(
filename
):
_value
=
True
if
self
.
itemsToShapesbox
:
self
.
actions
.
rotateRight
.
setEnabled
(
_value
)
self
.
rotateImgWarn
()
pix
=
cv2
.
imread
(
filename
)
else
:
pix
=
np
.
rot90
(
pix
,
k
=-
1
)
_value
=
True
cv2
.
imwrite
(
filename
,
pix
)
self
.
rotateImg
(
filename
=
filename
,
k
=-
1
,
_value
=
_value
)
self
.
canvas
.
update
()
self
.
loadFile
(
filename
)
else
:
else
:
_value
=
False
_value
=
False
self
.
rotateImgWarn
()
if
self
.
lang
==
'ch'
:
self
.
msgBox
.
warning
(
self
,
"提示"
,
"
\n
请从图片列表选择一个需要旋转的图片,且确保图片存在!"
)
else
:
self
.
msgBox
.
warning
(
self
,
"Warn"
,
"
\n
Please select an image from the list of images to rotate and make sure the image exists!"
)
self
.
actions
.
rotateRight
.
setEnabled
(
_value
)
self
.
actions
.
rotateRight
.
setEnabled
(
_value
)
def
toggleDrawingSensitive
(
self
,
drawing
=
True
):
def
toggleDrawingSensitive
(
self
,
drawing
=
True
):
...
...
PPOCRLabel/libs/resources.py
浏览文件 @
ca6fabf4
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录