Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Minibot Vision
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
Service Desk
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Institut für Informatik
stair
Minibot Vision
Commits
ebcd1db2
Commit
ebcd1db2
authored
1 year ago
by
User expired
Browse files
Options
Downloads
Patches
Plain Diff
made image patch publish faster
parent
284ca224
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
minibot_vision/scripts/SegmentSign.py
+4
-0
4 additions, 0 deletions
minibot_vision/scripts/SegmentSign.py
minibot_vision/scripts/SignDetector.py
+34
-4
34 additions, 4 deletions
minibot_vision/scripts/SignDetector.py
with
38 additions
and
4 deletions
minibot_vision/scripts/SegmentSign.py
+
4
−
0
View file @
ebcd1db2
...
...
@@ -56,7 +56,11 @@ def fetch_rosparams():
global
canny
,
accum_thresh
,
ZOOM_THREASHOLD
,
MIN_DEPTH
,
MAX_DEPTH
,
MIN_RADIUS
,
MAX_RADIUS
canny
=
rospy
.
get_param
(
"
sign_detector/canny_param1
"
)
if
canny
<
1
:
canny
=
1
accum_thresh
=
rospy
.
get_param
(
"
sign_detector/canny_param2
"
)
if
accum_thresh
<
1
:
accum_thresh
=
1
ZOOM_THREASHOLD
=
rospy
.
get_param
(
"
sign_detector/zoom_threshold
"
)
MIN_DEPTH
=
rospy
.
get_param
(
"
sign_detector/min_depth
"
)
...
...
This diff is collapsed.
Click to expand it.
minibot_vision/scripts/SignDetector.py
+
34
−
4
View file @
ebcd1db2
...
...
@@ -15,6 +15,8 @@ from copy import copy
from
vision_msgs.msg
import
Detection2D
,
ObjectHypothesisWithPose
from
minibot_msgs.srv
import
set_url
import
time
from
threading
import
Thread
# *** CONSTANTS ***
visualize
=
True
...
...
@@ -39,6 +41,7 @@ enable_capture_images = False
toggle_hough_detection
=
True
pub_raw_img
=
None
pub_cmpr_img
=
None
pub_img_patch_rate
=
None
# subscribe to RGB img
def
image_color_callback
(
data
):
...
...
@@ -128,9 +131,9 @@ def detect_sign(img_rgb_stream, image_timestamp):
patches
=
SegmentSign
.
get_tensor_patches
(
img_orig
,
keypoints
,
zoom
=
toggle_hough_detection
)
# publish patch for capture images
if
enable_capture_images
:
if
len
(
patches
)
>=
1
:
publish_img_patch
(
patches
[
0
])
#
if enable_capture_images:
#
if len(patches) >= 1:
#
publish_img_patch(patches[0])
# cut to multiple images at keypoints
text
=
[]
...
...
@@ -179,9 +182,13 @@ def set_visualize_callback(req):
def
enable_capture_callback
(
req
):
global
enable_capture_images
global
enable_capture_images
,
pub_img_patch_rate
enable_capture_images
=
req
.
data
if
enable_capture_images
:
pub_img_patch_rate
=
rospy
.
Rate
(
15
)
else
:
pub_img_patch_rate
=
rospy
.
Rate
(
5
)
rospy
.
loginfo
(
"
({}) set enable_capture_images to {}
"
.
format
(
rospy
.
get_name
(),
enable_capture_images
))
return
True
,
""
...
...
@@ -212,6 +219,25 @@ def update_rosparams_callback(req):
return
True
,
""
def
pub_image_patch_thread
():
global
pub_img_patch_rate
,
img_depth_stream
,
img_rgb_stream
,
enable_capture_images
pub_img_patch_rate
=
rospy
.
Rate
(
5
)
while
not
rospy
.
is_shutdown
():
if
enable_capture_images
:
img_orig
=
np
.
copy
(
img_rgb_stream
)
keypoints
=
hough_pipeline
(
img_orig
,
img_depth_stream
)
patches
=
SegmentSign
.
get_tensor_patches
(
img_orig
,
keypoints
,
zoom
=
toggle_hough_detection
)
# publish patch for capture images
if
len
(
patches
)
>=
1
:
publish_img_patch
(
patches
[
0
])
pub_img_patch_rate
.
sleep
()
if
__name__
==
"
__main__
"
:
rospy
.
init_node
(
"
sign_detector
"
)
...
...
@@ -241,6 +267,10 @@ if __name__ == "__main__":
rospy
.
loginfo
(
"
({}) Sign classification running with params fps: {}, visualization_compression_factor: {}
"
.
format
(
rospy
.
get_name
(),
fps
,
visualization_compression_factor
))
pub_image_patch_worker
=
Thread
(
target
=
pub_image_patch_thread
)
pub_image_patch_worker
.
deamon
=
True
pub_image_patch_worker
.
start
()
rate
=
rospy
.
Rate
(
fps
)
while
not
rospy
.
is_shutdown
():
detect_sign
(
img_rgb_stream
,
img_rgb_timestamp
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment