Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tilman Marquart
Art Structures - LME Praktikum
Commits
4eccdaaa
Unverified
Commit
4eccdaaa
authored
Dec 24, 2019
by
tilman
Browse files
fixing angles
parent
fa767bec
Changes
2
Hide whitespace changes
Inline
Side-by-side
detect_structures.py
View file @
4eccdaaa
...
@@ -18,7 +18,7 @@ BISEC_VECTORS = True
...
@@ -18,7 +18,7 @@ BISEC_VECTORS = True
BISEC_CONES
=
True
BISEC_CONES
=
True
GLOBAL_LINE
=
True
GLOBAL_LINE
=
True
BISEC_CONE_ANGLE
=
40
BISEC_CONE_ANGLE
=
40
CORRECTION_ANGLE
=
2
0
CORRECTION_ANGLE
=
3
0
OVERLAY_ALPHA
=
0.2
OVERLAY_ALPHA
=
0.2
BISEC_SKIP_LOWER_LEVELS
=
False
BISEC_SKIP_LOWER_LEVELS
=
False
OUT_DIR
=
'images/out/images_imdahl/main_structure_cones'
OUT_DIR
=
'images/out/images_imdahl/main_structure_cones'
...
@@ -57,7 +57,7 @@ for img_name in images:
...
@@ -57,7 +57,7 @@ for img_name in images:
datum
.
cvInputData
=
img
datum
.
cvInputData
=
img
opWrapper
.
emplaceAndPop
([
datum
])
opWrapper
.
emplaceAndPop
([
datum
])
#
img = datum.cvOutputData
img
=
datum
.
cvOutputData
#overlay = img.copy()
#overlay = img.copy()
#print("poses:"+str(len(datum.poseKeypoints)))
#print("poses:"+str(len(datum.poseKeypoints)))
...
...
lib/bisection.py
View file @
4eccdaaa
...
@@ -14,7 +14,15 @@ def getAngle(a,b,c, CORRECTION_ANGLE):
...
@@ -14,7 +14,15 @@ def getAngle(a,b,c, CORRECTION_ANGLE):
bc
=
c
-
b
bc
=
c
-
b
cosine_angle
=
np
.
dot
(
ba
,
bc
)
/
(
np
.
linalg
.
norm
(
ba
)
*
np
.
linalg
.
norm
(
bc
))
cosine_angle
=
np
.
dot
(
ba
,
bc
)
/
(
np
.
linalg
.
norm
(
ba
)
*
np
.
linalg
.
norm
(
bc
))
angle
=
np
.
arccos
(
cosine_angle
)
angle
=
np
.
arccos
(
cosine_angle
)
angle
=
angle
-
np
.
deg2rad
(
CORRECTION_ANGLE
)
print
(
"angle"
,
angle
,
np
.
rad2deg
(
angle
),
360
-
np
.
rad2deg
(
angle
),
180
-
np
.
rad2deg
(
angle
))
# TODO get the angle right....
# angle = angle - np.deg2rad(CORRECTION_ANGLE)
if
(
a
[
0
]
-
b
[
0
]
<
0
):
#check wich direction (left/right) the vector should point
print
(
"left angle"
,
angle
,
np
.
rad2deg
(
angle
))
angle
=
360
-
angle
#- np.deg2rad(CORRECTION_ANGLE)
else
:
print
(
"right angle"
,
angle
,
np
.
rad2deg
(
angle
))
angle
=
180
-
angle
#+ np.deg2rad(CORRECTION_ANGLE)
return
angle
return
angle
def
getGlobalLineAngle
(
poses
,
CORRECTION_ANGLE
):
def
getGlobalLineAngle
(
poses
,
CORRECTION_ANGLE
):
...
@@ -22,10 +30,6 @@ def getGlobalLineAngle(poses, CORRECTION_ANGLE):
...
@@ -22,10 +30,6 @@ def getGlobalLineAngle(poses, CORRECTION_ANGLE):
def
getBisecPoint
(
a
,
b
,
c
,
CORRECTION_ANGLE
):
def
getBisecPoint
(
a
,
b
,
c
,
CORRECTION_ANGLE
):
angle
=
getAngle
(
a
,
b
,
c
,
CORRECTION_ANGLE
)
angle
=
getAngle
(
a
,
b
,
c
,
CORRECTION_ANGLE
)
if
(
a
[
0
]
-
b
[
0
]
<
0
):
#check wich direction (left/right) the vector should point
angle
=
360
-
angle
else
:
angle
=
180
-
angle
angle
=
angle
/
2
angle
=
angle
/
2
dist
=
la
.
norm
(
a
-
b
)
dist
=
la
.
norm
(
a
-
b
)
# dist = 100
# dist = 100
...
@@ -34,10 +38,6 @@ def getBisecPoint(a,b,c, CORRECTION_ANGLE):
...
@@ -34,10 +38,6 @@ def getBisecPoint(a,b,c, CORRECTION_ANGLE):
def
getBisecCone
(
a
,
b
,
c
,
width
,
CORRECTION_ANGLE
):
def
getBisecCone
(
a
,
b
,
c
,
width
,
CORRECTION_ANGLE
):
angle
=
getAngle
(
a
,
b
,
c
,
CORRECTION_ANGLE
)
angle
=
getAngle
(
a
,
b
,
c
,
CORRECTION_ANGLE
)
if
(
a
[
0
]
-
b
[
0
]
<
0
):
#check wich direction (left/right) the vector should point
angle
=
360
-
angle
else
:
angle
=
180
-
angle
angle
=
angle
/
2
angle
=
angle
/
2
#dist = la.norm(a-b)
#dist = la.norm(a-b)
dist
=
1500
dist
=
1500
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment