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
Sean Fitzgibbon
SlideR 🍔
Commits
b8babe87
Commit
b8babe87
authored
Dec 21, 2021
by
Sean Fitzgibbon
Browse files
Added additional preprocessing to _img_props
parent
410f89aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
slider/chart_reg.py
View file @
b8babe87
...
@@ -25,12 +25,15 @@ from slider import util
...
@@ -25,12 +25,15 @@ from slider import util
import
glymur
import
glymur
from
skimage.measure
import
regionprops
,
label
from
skimage.measure
import
regionprops
,
label
from
skimage.color
import
rgb2gray
from
skimage.color
import
rgb2gray
,
rgb2hsv
from
skimage
import
filters
,
transform
from
skimage
import
filters
,
transform
,
exposure
from
matplotlib
import
patches
from
matplotlib
import
patches
import
numpy
as
np
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
DO_PLOTS
=
False
OUTDIR
=
None
def
register_chart_to_slide
(
chart
,
slide
,
slide_res
,
out
,
boundary_key
=
None
,
config
=
None
):
def
register_chart_to_slide
(
chart
,
slide
,
slide_res
,
out
,
boundary_key
=
None
,
config
=
None
):
...
@@ -50,10 +53,7 @@ def register_chart_to_slide(chart, slide, slide_res, out, boundary_key=None, con
...
@@ -50,10 +53,7 @@ def register_chart_to_slide(chart, slide, slide_res, out, boundary_key=None, con
# set global variables required for summary plots
# set global variables required for summary plots
plots
=
config
[
"general"
][
"plots"
]
plots
=
config
[
"general"
][
"plots"
]
global
DO_PLOTS
DO_PLOTS
=
plots
DO_PLOTS
=
plots
global
OUTDIR
OUTDIR
=
out
OUTDIR
=
out
# create output dir
# create output dir
...
@@ -241,11 +241,15 @@ def _refine_edge_coord(img, img_res, edge_coords, normals):
...
@@ -241,11 +241,15 @@ def _refine_edge_coord(img, img_res, edge_coords, normals):
def
_img_props
(
img
,
img_resolution
,
verbose
=
False
):
def
_img_props
(
img
,
img_resolution
,
verbose
=
False
):
# convert to grayscale
#
#
convert to grayscale
image
=
rgb2gray
(
img
)
#
image = rgb2gray(img)
# find threshold for background
# # find threshold for background
threshold_value
=
filters
.
threshold_otsu
(
image
)
# threshold_value = filters.threshold_otsu(image)
image
=
rgb2hsv
(
img
)[...,
-
1
]
image
=
exposure
.
equalize_hist
(
image
)
threshold_value
=
filters
.
threshold_li
(
image
)
if
verbose
:
if
verbose
:
print
(
f
"threshold=
{
threshold_value
}
"
)
print
(
f
"threshold=
{
threshold_value
}
"
)
...
...
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