Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pt2d
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
QIM
Tools
pt2d
Merge requests
!3
Live wire to be implemented into GUI
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Live wire to be implemented into GUI
live_wire
into
GUI
Overview
0
Commits
10
Pipelines
0
Changes
1
Merged
s224389
requested to merge
live_wire
into
GUI
5 months ago
Overview
0
Commits
10
Pipelines
0
Changes
1
0
0
Merge request reports
Viewing commit
14451d92
Prev
Next
Show latest version
1 file
+
16
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
14451d92
Changed to cost image plot
· 14451d92
Christian
authored
5 months ago
live_wire.py
+
16
−
4
View file @ 14451d92
Edit in single-file editor
Open in Web IDE
Show full file
@@ -83,13 +83,21 @@ def backtrack_pixels_on_image(img_color, path_coords, bgr_color=(0, 0, 255)):
img_color
[
row
,
col
]
=
bgr_color
return
img_color
def
export_path
(
path_coords
,
path_name
):
"""
Export the path to a np array.
"""
np
.
save
(
path_name
,
path_coords
)
return
None
#### Main Script ####
def
main
():
# Define input parameters
image_path
=
'
bipes
_slice.png
'
image_path
=
'
agamodon
_slice.png
'
image_type
=
'
gray
'
# 'gray' or 'color'
downscale_factor
=
100
# % of original size
points_path
=
'
bipes
Points.npy
'
points_path
=
'
agamodon
Points.npy
'
# Load image
image
=
load_image
(
image_path
,
image_type
)
@@ -128,11 +136,15 @@ def main():
# If you want to mark it in red, do (0,0,255) because OpenCV uses BGR format.
color_img
=
backtrack_pixels_on_image
(
color_img
,
path_rc
,
bgr_color
=
(
0
,
0
,
255
))
# Export path
export_path
(
path_rc
,
'
agamodonPath.npy
'
)
# Display results
plt
.
figure
(
figsize
=
(
20
,
8
))
plt
.
subplot
(
1
,
2
,
1
)
plt
.
title
(
"
C
anny Ed
ge
s
"
)
plt
.
imshow
(
c
anny_img
,
cmap
=
'
gray
'
)
plt
.
title
(
"
C
ost ima
ge
"
)
plt
.
imshow
(
c
ost_image
,
cmap
=
'
gray
'
)
plt
.
subplot
(
1
,
2
,
2
)
plt
.
title
(
"
Path from Seed to Target
"
)
Loading