Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
f68f7df7
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看板
提交
f68f7df7
编写于
7月 22, 2021
作者:
赛佬的小迷弟
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update move box
上级
6887f457
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
34 deletion
+42
-34
PPOCRLabel/PPOCRLabel.py
PPOCRLabel/PPOCRLabel.py
+10
-4
PPOCRLabel/libs/canvas.py
PPOCRLabel/libs/canvas.py
+32
-30
未找到文件。
PPOCRLabel/PPOCRLabel.py
浏览文件 @
f68f7df7
...
...
@@ -885,10 +885,16 @@ class MainWindow(QMainWindow, WindowMixin):
self
.
updateComboBox
()
def
updateBoxlist
(
self
):
for
shape
in
self
.
canvas
.
selectedShapes
+
[
self
.
canvas
.
hShape
]:
item
=
self
.
shapesToItemsbox
[
shape
]
# listitem
text
=
[(
int
(
p
.
x
()),
int
(
p
.
y
()))
for
p
in
shape
.
points
]
item
.
setText
(
str
(
text
))
if
self
.
canvas
.
hShape
!=
None
:
for
shape
in
self
.
canvas
.
selectedShapes
+
[
self
.
canvas
.
hShape
]:
item
=
self
.
shapesToItemsbox
[
shape
]
# listitem
text
=
[(
int
(
p
.
x
()),
int
(
p
.
y
()))
for
p
in
shape
.
points
]
item
.
setText
(
str
(
text
))
else
:
for
shape
in
self
.
canvas
.
selectedShapes
:
item
=
self
.
shapesToItemsbox
[
shape
]
# listitem
text
=
[(
int
(
p
.
x
()),
int
(
p
.
y
()))
for
p
in
shape
.
points
]
item
.
setText
(
str
(
text
))
self
.
actions
.
undo
.
setEnabled
(
True
)
self
.
setDirty
()
...
...
PPOCRLabel/libs/canvas.py
浏览文件 @
f68f7df7
...
...
@@ -709,43 +709,45 @@ class Canvas(QWidget):
self
.
update
()
elif
key
==
Qt
.
Key_Return
and
self
.
canCloseShape
():
self
.
finalise
()
elif
key
==
Qt
.
Key_Left
and
self
.
selectedShape
:
elif
key
==
Qt
.
Key_Left
and
self
.
selectedShape
s
:
self
.
moveOnePixel
(
'Left'
)
elif
key
==
Qt
.
Key_Right
and
self
.
selectedShape
:
elif
key
==
Qt
.
Key_Right
and
self
.
selectedShape
s
:
self
.
moveOnePixel
(
'Right'
)
elif
key
==
Qt
.
Key_Up
and
self
.
selectedShape
:
elif
key
==
Qt
.
Key_Up
and
self
.
selectedShape
s
:
self
.
moveOnePixel
(
'Up'
)
elif
key
==
Qt
.
Key_Down
and
self
.
selectedShape
:
elif
key
==
Qt
.
Key_Down
and
self
.
selectedShape
s
:
self
.
moveOnePixel
(
'Down'
)
def
moveOnePixel
(
self
,
direction
):
# print(self.selectedShape.points)
if
direction
==
'Left'
and
not
self
.
moveOutOfBound
(
QPointF
(
-
1.0
,
0
)):
# print("move Left one pixel")
self
.
selectedShape
.
points
[
0
]
+=
QPointF
(
-
1.0
,
0
)
self
.
selectedShape
.
points
[
1
]
+=
QPointF
(
-
1.0
,
0
)
self
.
selectedShape
.
points
[
2
]
+=
QPointF
(
-
1.0
,
0
)
self
.
selectedShape
.
points
[
3
]
+=
QPointF
(
-
1.0
,
0
)
elif
direction
==
'Right'
and
not
self
.
moveOutOfBound
(
QPointF
(
1.0
,
0
)):
# print("move Right one pixel")
self
.
selectedShape
.
points
[
0
]
+=
QPointF
(
1.0
,
0
)
self
.
selectedShape
.
points
[
1
]
+=
QPointF
(
1.0
,
0
)
self
.
selectedShape
.
points
[
2
]
+=
QPointF
(
1.0
,
0
)
self
.
selectedShape
.
points
[
3
]
+=
QPointF
(
1.0
,
0
)
elif
direction
==
'Up'
and
not
self
.
moveOutOfBound
(
QPointF
(
0
,
-
1.0
)):
# print("move Up one pixel")
self
.
selectedShape
.
points
[
0
]
+=
QPointF
(
0
,
-
1.0
)
self
.
selectedShape
.
points
[
1
]
+=
QPointF
(
0
,
-
1.0
)
self
.
selectedShape
.
points
[
2
]
+=
QPointF
(
0
,
-
1.0
)
self
.
selectedShape
.
points
[
3
]
+=
QPointF
(
0
,
-
1.0
)
elif
direction
==
'Down'
and
not
self
.
moveOutOfBound
(
QPointF
(
0
,
1.0
)):
# print("move Down one pixel")
self
.
selectedShape
.
points
[
0
]
+=
QPointF
(
0
,
1.0
)
self
.
selectedShape
.
points
[
1
]
+=
QPointF
(
0
,
1.0
)
self
.
selectedShape
.
points
[
2
]
+=
QPointF
(
0
,
1.0
)
self
.
selectedShape
.
points
[
3
]
+=
QPointF
(
0
,
1.0
)
self
.
shapeMoved
.
emit
()
self
.
repaint
()
for
i
in
range
(
len
(
self
.
selectedShapes
)):
self
.
selectedShape
=
self
.
selectedShapes
[
i
]
if
direction
==
'Left'
and
not
self
.
moveOutOfBound
(
QPointF
(
-
1.0
,
0
)):
# print("move Left one pixel")
self
.
selectedShape
.
points
[
0
]
+=
QPointF
(
-
1.0
,
0
)
self
.
selectedShape
.
points
[
1
]
+=
QPointF
(
-
1.0
,
0
)
self
.
selectedShape
.
points
[
2
]
+=
QPointF
(
-
1.0
,
0
)
self
.
selectedShape
.
points
[
3
]
+=
QPointF
(
-
1.0
,
0
)
elif
direction
==
'Right'
and
not
self
.
moveOutOfBound
(
QPointF
(
1.0
,
0
)):
# print("move Right one pixel")
self
.
selectedShape
.
points
[
0
]
+=
QPointF
(
1.0
,
0
)
self
.
selectedShape
.
points
[
1
]
+=
QPointF
(
1.0
,
0
)
self
.
selectedShape
.
points
[
2
]
+=
QPointF
(
1.0
,
0
)
self
.
selectedShape
.
points
[
3
]
+=
QPointF
(
1.0
,
0
)
elif
direction
==
'Up'
and
not
self
.
moveOutOfBound
(
QPointF
(
0
,
-
1.0
)):
# print("move Up one pixel")
self
.
selectedShape
.
points
[
0
]
+=
QPointF
(
0
,
-
1.0
)
self
.
selectedShape
.
points
[
1
]
+=
QPointF
(
0
,
-
1.0
)
self
.
selectedShape
.
points
[
2
]
+=
QPointF
(
0
,
-
1.0
)
self
.
selectedShape
.
points
[
3
]
+=
QPointF
(
0
,
-
1.0
)
elif
direction
==
'Down'
and
not
self
.
moveOutOfBound
(
QPointF
(
0
,
1.0
)):
# print("move Down one pixel")
self
.
selectedShape
.
points
[
0
]
+=
QPointF
(
0
,
1.0
)
self
.
selectedShape
.
points
[
1
]
+=
QPointF
(
0
,
1.0
)
self
.
selectedShape
.
points
[
2
]
+=
QPointF
(
0
,
1.0
)
self
.
selectedShape
.
points
[
3
]
+=
QPointF
(
0
,
1.0
)
self
.
shapeMoved
.
emit
()
self
.
repaint
()
def
moveOutOfBound
(
self
,
step
):
points
=
[
p1
+
p2
for
p1
,
p2
in
zip
(
self
.
selectedShape
.
points
,
[
step
]
*
4
)]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录