Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
4743843a
P
PaddleOCR
项目概览
s920243400
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
4743843a
编写于
8月 09, 2021
作者:
E
Evezerest
提交者:
GitHub
8月 09, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3399 from d2623587501/dygraph
Update move box
上级
f262e33e
ac8ba5fc
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
53 addition
and
31 deletion
+53
-31
PPOCRLabel/PPOCRLabel.py
PPOCRLabel/PPOCRLabel.py
+6
-1
PPOCRLabel/libs/canvas.py
PPOCRLabel/libs/canvas.py
+47
-30
未找到文件。
PPOCRLabel/PPOCRLabel.py
浏览文件 @
4743843a
...
@@ -885,7 +885,12 @@ class MainWindow(QMainWindow, WindowMixin):
...
@@ -885,7 +885,12 @@ class MainWindow(QMainWindow, WindowMixin):
self
.
updateComboBox
()
self
.
updateComboBox
()
def
updateBoxlist
(
self
):
def
updateBoxlist
(
self
):
for
shape
in
self
.
canvas
.
selectedShapes
+
[
self
.
canvas
.
hShape
]:
self
.
canvas
.
selectedShapes_hShape
=
[]
if
self
.
canvas
.
hShape
!=
None
:
self
.
canvas
.
selectedShapes_hShape
=
self
.
canvas
.
selectedShapes
+
[
self
.
canvas
.
hShape
]
else
:
self
.
canvas
.
selectedShapes_hShape
=
self
.
canvas
.
selectedShapes
for
shape
in
self
.
canvas
.
selectedShapes_hShape
:
item
=
self
.
shapesToItemsbox
[
shape
]
# listitem
item
=
self
.
shapesToItemsbox
[
shape
]
# listitem
text
=
[(
int
(
p
.
x
()),
int
(
p
.
y
()))
for
p
in
shape
.
points
]
text
=
[(
int
(
p
.
x
()),
int
(
p
.
y
()))
for
p
in
shape
.
points
]
item
.
setText
(
str
(
text
))
item
.
setText
(
str
(
text
))
...
...
PPOCRLabel/libs/canvas.py
浏览文件 @
4743843a
...
@@ -23,6 +23,7 @@ except ImportError:
...
@@ -23,6 +23,7 @@ except ImportError:
from
libs.shape
import
Shape
from
libs.shape
import
Shape
from
libs.utils
import
distance
from
libs.utils
import
distance
import
copy
CURSOR_DEFAULT
=
Qt
.
ArrowCursor
CURSOR_DEFAULT
=
Qt
.
ArrowCursor
CURSOR_POINT
=
Qt
.
PointingHandCursor
CURSOR_POINT
=
Qt
.
PointingHandCursor
...
@@ -81,6 +82,7 @@ class Canvas(QWidget):
...
@@ -81,6 +82,7 @@ class Canvas(QWidget):
self
.
fourpoint
=
True
# ADD
self
.
fourpoint
=
True
# ADD
self
.
pointnum
=
0
self
.
pointnum
=
0
self
.
movingShape
=
False
self
.
movingShape
=
False
self
.
selectCountShape
=
False
#initialisation for panning
#initialisation for panning
self
.
pan_initial_pos
=
QPoint
()
self
.
pan_initial_pos
=
QPoint
()
...
@@ -702,6 +704,10 @@ class Canvas(QWidget):
...
@@ -702,6 +704,10 @@ class Canvas(QWidget):
def
keyPressEvent
(
self
,
ev
):
def
keyPressEvent
(
self
,
ev
):
key
=
ev
.
key
()
key
=
ev
.
key
()
shapesBackup
=
[]
shapesBackup
=
copy
.
deepcopy
(
self
.
shapes
)
self
.
shapesBackups
.
pop
()
self
.
shapesBackups
.
append
(
shapesBackup
)
if
key
==
Qt
.
Key_Escape
and
self
.
current
:
if
key
==
Qt
.
Key_Escape
and
self
.
current
:
print
(
'ESC press'
)
print
(
'ESC press'
)
self
.
current
=
None
self
.
current
=
None
...
@@ -709,17 +715,21 @@ class Canvas(QWidget):
...
@@ -709,17 +715,21 @@ class Canvas(QWidget):
self
.
update
()
self
.
update
()
elif
key
==
Qt
.
Key_Return
and
self
.
canCloseShape
():
elif
key
==
Qt
.
Key_Return
and
self
.
canCloseShape
():
self
.
finalise
()
self
.
finalise
()
elif
key
==
Qt
.
Key_Left
and
self
.
selectedShape
:
elif
key
==
Qt
.
Key_Left
and
self
.
selectedShape
s
:
self
.
moveOnePixel
(
'Left'
)
self
.
moveOnePixel
(
'Left'
)
elif
key
==
Qt
.
Key_Right
and
self
.
selectedShape
:
elif
key
==
Qt
.
Key_Right
and
self
.
selectedShape
s
:
self
.
moveOnePixel
(
'Right'
)
self
.
moveOnePixel
(
'Right'
)
elif
key
==
Qt
.
Key_Up
and
self
.
selectedShape
:
elif
key
==
Qt
.
Key_Up
and
self
.
selectedShape
s
:
self
.
moveOnePixel
(
'Up'
)
self
.
moveOnePixel
(
'Up'
)
elif
key
==
Qt
.
Key_Down
and
self
.
selectedShape
:
elif
key
==
Qt
.
Key_Down
and
self
.
selectedShape
s
:
self
.
moveOnePixel
(
'Down'
)
self
.
moveOnePixel
(
'Down'
)
def
moveOnePixel
(
self
,
direction
):
def
moveOnePixel
(
self
,
direction
):
# print(self.selectedShape.points)
# print(self.selectedShape.points)
self
.
selectCount
=
len
(
self
.
selectedShapes
)
self
.
selectCountShape
=
True
for
i
in
range
(
len
(
self
.
selectedShapes
)):
self
.
selectedShape
=
self
.
selectedShapes
[
i
]
if
direction
==
'Left'
and
not
self
.
moveOutOfBound
(
QPointF
(
-
1.0
,
0
)):
if
direction
==
'Left'
and
not
self
.
moveOutOfBound
(
QPointF
(
-
1.0
,
0
)):
# print("move Left one pixel")
# print("move Left one pixel")
self
.
selectedShape
.
points
[
0
]
+=
QPointF
(
-
1.0
,
0
)
self
.
selectedShape
.
points
[
0
]
+=
QPointF
(
-
1.0
,
0
)
...
@@ -744,6 +754,9 @@ class Canvas(QWidget):
...
@@ -744,6 +754,9 @@ class Canvas(QWidget):
self
.
selectedShape
.
points
[
1
]
+=
QPointF
(
0
,
1.0
)
self
.
selectedShape
.
points
[
1
]
+=
QPointF
(
0
,
1.0
)
self
.
selectedShape
.
points
[
2
]
+=
QPointF
(
0
,
1.0
)
self
.
selectedShape
.
points
[
2
]
+=
QPointF
(
0
,
1.0
)
self
.
selectedShape
.
points
[
3
]
+=
QPointF
(
0
,
1.0
)
self
.
selectedShape
.
points
[
3
]
+=
QPointF
(
0
,
1.0
)
shapesBackup
=
[]
shapesBackup
=
copy
.
deepcopy
(
self
.
shapes
)
self
.
shapesBackups
.
append
(
shapesBackup
)
self
.
shapeMoved
.
emit
()
self
.
shapeMoved
.
emit
()
self
.
repaint
()
self
.
repaint
()
...
@@ -840,6 +853,10 @@ class Canvas(QWidget):
...
@@ -840,6 +853,10 @@ class Canvas(QWidget):
def
restoreShape
(
self
):
def
restoreShape
(
self
):
if
not
self
.
isShapeRestorable
:
if
not
self
.
isShapeRestorable
:
return
return
if
self
.
selectCountShape
:
if
len
(
self
.
shapesBackups
)
>
2
:
for
i
in
range
(
1
,
self
.
selectCount
):
self
.
shapesBackups
.
pop
()
self
.
shapesBackups
.
pop
()
# latest
self
.
shapesBackups
.
pop
()
# latest
shapesBackup
=
self
.
shapesBackups
.
pop
()
shapesBackup
=
self
.
shapesBackups
.
pop
()
self
.
shapes
=
shapesBackup
self
.
shapes
=
shapesBackup
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录