Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
RoboQualityController
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
RoboCT (Public)
RoboQuality
RoboQualityController
Commits
c4d250b2
Commit
c4d250b2
authored
9 months ago
by
Simon Wittl
Browse files
Options
Downloads
Patches
Plain Diff
switched roi interface
parent
c9aeaf1b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rq_controller/common/region_of_intrest.py
+48
-20
48 additions, 20 deletions
rq_controller/common/region_of_intrest.py
with
48 additions
and
20 deletions
rq_controller/common/region_of_intrest.py
+
48
−
20
View file @
c4d250b2
import
numpy
as
np
import
numpy
as
np
from
rq_interfaces.msg
import
RegionOfIntrest
from
rq_interfaces.msg
import
RegionOfIntrest
from
visualization_msgs.msg
import
Marker
class
PyRegionOfIntrest
():
class
PyRegionOfIntrest
():
def
__init__
(
self
,
start_point_mm
:
np
.
ndarray
,
end_point_mm
:
np
.
ndarray
,
frame_id
:
str
=
'
object
'
):
def
__init__
(
self
,
center_points_mm
:
np
.
ndarray
,
dimensions_mm
:
np
.
ndarray
,
frame_id
:
str
=
'
object
'
,
self
.
start_point_mm
=
start_point_mm
resolution_mm
:
np
.
ndarray
=
np
.
array
([
0.1
,
0.1
,
0.1
])):
self
.
end_point_mm
=
end_point_mm
self
.
center_points_mm
=
center_points_mm
self
.
dimensions_mm
=
dimensions_mm
self
.
frame_id
=
frame_id
self
.
frame_id
=
frame_id
self
.
resolution_mm
=
resolution_mm
@classmethod
@classmethod
def
dummy
(
cls
):
def
dummy
(
cls
):
return
cls
(
np
.
ones
(
3
,)
*
-
1
,
np
.
ones
(
3
,))
return
cls
((
np
.
random
.
random
((
3
,
3
))
-
0.5
)
*
20.
,
(
np
.
random
.
random
((
3
,
3
))
-
0.5
)
*
10.
)
@classmethod
@classmethod
def
from_message
(
cls
,
msg
:
RegionOfIntrest
):
def
from_message
(
cls
,
msg
:
RegionOfIntrest
):
start_point
=
np
.
array
([
msg
.
start_point_mm
.
x
,
center_points_mm
=
list
()
msg
.
start_point_mm
.
y
,
dimensions_mm
=
list
()
msg
.
start_point_mm
.
z
])
for
roi
in
msg
.
region_of_intrest_stack
.
markers
:
end_point
=
np
.
array
([
msg
.
end_point_mm
.
x
,
roi
:
Marker
msg
.
end_point_mm
.
y
,
center_points_mm
.
append
(
msg
.
end_point_mm
.
z
])
np
.
array
([
roi
.
pose
.
position
.
x
,
frame
=
msg
.
header
.
frame_id
roi
.
pose
.
position
.
y
,
roi
.
pose
.
position
.
z
]))
dimensions_mm
.
append
(
np
.
array
([
roi
.
scale
.
x
,
roi
.
scale
.
y
,
roi
.
scale
.
z
]))
frame
=
roi
.
header
.
frame_id
resolution_mm
=
np
.
array
([
msg
.
resolution
.
x
,
msg
.
resolution
.
y
,
msg
.
resolution
.
z
])
return
cls
(
start_point
,
end_point
,
frame
)
return
cls
(
np
.
array
(
center_points_mm
),
np
.
array
(
dimensions_mm
),
frame
,
resolution_mm
)
@property
def
number_of_rois
(
self
)
->
int
:
return
self
.
center_points_mm
.
shape
[
0
]
def
as_message
(
self
)
->
RegionOfIntrest
:
def
as_message
(
self
)
->
RegionOfIntrest
:
message
=
RegionOfIntrest
()
message
=
RegionOfIntrest
()
message
.
start_point_mm
.
x
=
self
.
start_point_mm
[
0
]
for
i
in
range
(
self
.
number_of_rois
):
message
.
start_point_mm
.
y
=
self
.
start_point_mm
[
1
]
roi
=
Marker
()
message
.
start_point_mm
.
z
=
self
.
start_point_mm
[
2
]
message
.
start_point_mm
.
x
=
self
.
start_point_mm
[
0
]
roi
.
pose
.
position
.
x
=
self
.
center_points_mm
[
i
][
0
]
message
.
start_point_mm
.
y
=
self
.
start_point_mm
[
1
]
roi
.
pose
.
position
.
y
=
self
.
center_points_mm
[
i
][
1
]
message
.
start_point_mm
.
z
=
self
.
start_point_mm
[
2
]
roi
.
pose
.
position
.
z
=
self
.
center_points_mm
[
i
][
2
]
roi
.
scale
.
x
=
self
.
dimensions_mm
[
i
][
0
]
roi
.
scale
.
y
=
self
.
dimensions_mm
[
i
][
1
]
roi
.
scale
.
z
=
self
.
dimensions_mm
[
i
][
2
]
roi
.
header
.
frame_id
=
self
.
frame_id
message
.
region_of_intrest_stack
.
markers
=
list
(
message
)
message
.
header
.
frame_id
=
self
.
frame_id
message
.
resolution
.
x
=
self
.
resolution_mm
[
0
]
message
.
resolution
.
x
=
self
.
resolution_mm
[
1
]
message
.
resolution
.
x
=
self
.
resolution_mm
[
2
]
return
message
return
message
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