Commit 1b4d3256 authored by Sean Fitzgibbon's avatar Sean Fitzgibbon
Browse files

added untested binary closing option

parent b8babe87
......@@ -26,7 +26,7 @@ import glymur
from skimage.measure import regionprops, label
from skimage.color import rgb2gray, rgb2hsv
from skimage import filters, transform, exposure
from skimage import filters, transform, exposure, morphology
from matplotlib import patches
import numpy as np
import matplotlib.pyplot as plt
......@@ -239,7 +239,7 @@ def _refine_edge_coord(img, img_res, edge_coords, normals):
return refined_edge_coords
def _img_props(img, img_resolution, verbose=False):
def _img_props(img, img_resolution, verbose=False, closing=0):
# # convert to grayscale
# image = rgb2gray(img)
......@@ -258,6 +258,9 @@ def _img_props(img, img_resolution, verbose=False):
# NOTE: this assumes a bright background!
labeled_foreground = (image < threshold_value).astype(int)
if closing > 0:
labeled_foreground = morphology.binary_closing(labeled_foreground, selem=morphology.disk(closing))
# calculate connected components
cc = label(labeled_foreground, background=0)
......
Markdown is supported
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