Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design2
/
2016104095
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
강세희
2021-04-11 17:13:29 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7a937cd95cbdb52a67452a3bace39ce12f16f7bb
7a937cd9
1 parent
d457d4f7
[UPDATE] 기존 코드 수정
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
codes/Project/project.py
codes/Project/project.py
View file @
7a937cd
import
time
import
math
import
cv2
import
numpy
as
np
from
model.yolo_model
import
YOLO
class
Point2D
:
def
__init__
(
self
,
width
,
height
):
self
.
width
=
width
self
.
height
=
height
def
process_image
(
img
):
image
=
cv2
.
resize
(
img
,
(
416
,
416
),
...
...
@@ -53,7 +58,11 @@ if __name__ == '__main__':
name
=
all_classes
[
cl
]
size
=
w
*
h
# 얼마나 가운데인지 확인하는 알고리즘
coordinatevalue
=
abs
((
x
+
0.5
*
w
)
-
image
.
shape
[
1
]
/
2
)
+
abs
((
y
-
h
*
0.5
)
-
image
.
shape
[
0
]
/
2
)
/
(
image
.
shape
[
0
]
/
image
.
shape
[
1
])
object
=
Point2D
(
width
=
x
+
0.5
*
w
,
height
=
y
-
h
*
0.5
)
a
=
image
.
shape
[
1
]
/
2
-
object
.
width
b
=
image
.
shape
[
0
]
/
2
-
object
.
height
coordinatevalue
=
math
.
sqrt
((
a
*
a
)
+
(
b
*
b
))
detectionInfo
.
append
([
i
,
name
,
size
,
coordinatevalue
])
# name 별로 크기가 가장 크거나 물체가 프레임의 가운데 있는 프레임 번호 목록 얻어오기
...
...
Please
register
or
login
to post a comment