Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SVLT
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
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
ALMF
SVLT
Commits
9cb4cdd4
Commit
9cb4cdd4
authored
9 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Use platform-independent method for getting font
parent
adf7ef0f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
model_server/base/annotators.py
+13
-1
13 additions, 1 deletion
model_server/base/annotators.py
with
13 additions
and
1 deletion
model_server/base/annotators.py
+
13
−
1
View file @
9cb4cdd4
import
numpy
as
np
from
matplotlib
import
font_manager
from
PIL
import
Image
,
ImageDraw
,
ImageFont
from
model_server.base.process
import
rescale
def
_get_font
():
return
ImageFont
.
truetype
(
font_manager
.
findfont
(
font_manager
.
FontProperties
(
family
=
'
sans-serif
'
,
weight
=
'
bold
'
)
)
)
def
draw_boxes_on_3d_image
(
roiset
,
draw_full_depth
=
False
,
**
kwargs
):
h
,
w
,
chroma
,
nz
=
roiset
.
acc_raw
.
shape
font_size
=
kwargs
.
get
(
'
font_size
'
,
18
)
...
...
@@ -25,7 +37,7 @@ def draw_boxes_on_3d_image(roiset, draw_full_depth=False, **kwargs):
for
ci
in
range
(
0
,
len
(
channels
)):
pilimg
=
Image
.
fromarray
(
roiset
.
acc_raw
.
data
[:,
:,
channels
[
ci
],
zi
])
draw
=
ImageDraw
.
Draw
(
pilimg
)
draw
.
font
=
ImageFont
.
truetype
(
font
=
"
arial.ttf
"
,
size
=
font_size
)
draw
.
font
=
_get_font
(
)
for
roi
in
subset
.
itertuples
(
'
Roi
'
):
xm
=
round
((
roi
.
x0
+
roi
.
x1
)
/
2
)
...
...
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