Commit b8babe87 authored by Sean Fitzgibbon's avatar Sean Fitzgibbon
Browse files

Added additional preprocessing to _img_props

parent 410f89aa
......@@ -25,12 +25,15 @@ from slider import util
import glymur
from skimage.measure import regionprops, label
from skimage.color import rgb2gray
from skimage import filters, transform
from skimage.color import rgb2gray, rgb2hsv
from skimage import filters, transform, exposure
from matplotlib import patches
import numpy as np
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):
......@@ -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
plots = config["general"]["plots"]
global DO_PLOTS
DO_PLOTS = plots
global OUTDIR
OUTDIR = out
# create output dir
......@@ -241,11 +241,15 @@ def _refine_edge_coord(img, img_res, edge_coords, normals):
def _img_props(img, img_resolution, verbose=False):
# convert to grayscale
image = rgb2gray(img)
# # convert to grayscale
# image = rgb2gray(img)
# find threshold for background
threshold_value = filters.threshold_otsu(image)
# # find threshold for background
# threshold_value = filters.threshold_otsu(image)
image = rgb2hsv(img)[..., -1]
image = exposure.equalize_hist(image)
threshold_value = filters.threshold_li(image)
if verbose:
print(f"threshold={threshold_value}")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment