Ejemplo n.º 1
0
def extract_cells(image, threshold=24):

    # creating the structuring element
    elem = pink.char_image([3, 3])
    elem.fill(1)
    elem.center = [1, 1]

    grad = pink.gradmorph(muscle, elem)
    seuil = pink.seuil(grad, threshold)
    frame = pink.frame(pink.char_image(image.size), 255)
    dilated = pink.geodilat(frame, seuil, 8)
    skeleton = pink.skeleton(dilated, 0, 8)
    inv = pink.inverse(skeleton)
    eroded = pink.erosball(inv, 5)
    inv = pink.inverse(eroded)
    skeleton2 = pink.skeleton(inv, image, 4)

    return skeleton2
Ejemplo n.º 2
0
def extract_runways(image, brightness_threshold=23, beed_filter_radius=3):
    seuil = pink.seuil(image, brightness_threshold)
    inv = pink.inverse(seuil)
    asf = pink.asfbin(inv, beed_filter_radius)
    skeleton = pink.skeleton(asf, 0, 8)
    ptcurve = pink.ptcurve(skeleton, 8)
    dilated = pink.geodilat(ptcurve, asf, 8)
    skelcurv = pink.skelcurv(dilated, 0, 8)
    return skelcurv
Ejemplo n.º 3
0
def extract_fractures(image):
    seuil = pink.seuil(image, 123)
    inv = pink.inverse(seuil)
    skeleton1 = pink.skelcurv(inv, 0, 8)
    endpoints = pink.ptend(skeleton1, 8)
    dilated = pink.dilatball(endpoints, 1, 8)
    sub = skeleton1 - dilated
    add = endpoints + sub
    inv = pink.inverse(add)
    skeleton2 = pink.skeleton(inv, 0, 4)
    inv = pink.inverse(skeleton2)
    dilated = pink.geodilat(endpoints, inv, 4)
    return dilated
Ejemplo n.º 4
0
# UjoImro, 2012
# ProCarPlan s.r.o.
# CeCILL free-software license

# convert image to graph structure

from pink import imview as imview
from pink import cpp as pink

global DEBUG
DEBUG = 1

im = pink.readimage("../images/uo_w.pgm")
imf = pink.frame(im, 255)  # adds a white frame inside the image
imf = pink.frame_around(imf, 0)  # adds a black frame outside the image
skelim = pink.skeleton(imf, 0, 8)  # get rid of simple points
imview(skelim)

skel = pink.image2skel(skelim, 8)
skel.writeskel("_skelpy.skel")

graph = pink.skel2graph(skel, 1)
graph.writegraph("_graphpy.graph")
graph.writeps("_graphpy.ps", 0.3)

# LuM end of file
Ejemplo n.º 5
0
def try_DLMA_topo(la):
    dlma = pink.lambdamedialaxis(IMAGE)
    constr = pink.seuil(dlma, la, 0, 255)
    constr = pink.float2byte(constr)
    res = pink.skeleton(IMAGE, dlma, 8, constr)
    return res
Ejemplo n.º 6
0
    view3d(carotide, dilated)
diff = carotide - dilated

seuil = pink.seuil(diff, 94)
if debug:
    view3d(carotide, seuil)
component = pink.selectcomp(seuil, 26, 58, 46, 0)
if debug:
    view3d(carotide, component)
carotide_seg = component

###  the skeleton operator
axonepair = pink.readimage("../images/axonepair.pgm")
#imview(axonepair) ## HUGUES WRITE ME!
blank = pink.char_image(axonepair.size)
skeleton = pink.skeleton(axonepair, blank, 8)
#imview(skeleton)
pink.surimp(axonepair, skeleton, "axoskel.ppm")

###  distances
dist = pink.distc(axonepair, 4)
dist.writeimage("imagea.pgm")
### randrgb will be replaced with imview colourmap (rand rgb)
dist = pink.distc(axonepair, 8)
dist.writeimage("imageb.pgm")

dist = pink.distc(axonepair, 0)
dist.writeimage("imagec.pgm")

### skeletons guided by a priority image
skeleton = pink.skeleton(axonepair, 4, 8)
Ejemplo n.º 7
0
# UjoImro, 2010
# CeCILL free-software license

# Michel's TP-2

from pink import imview
from pink import cpp as pink

debug = True

#sol_outils1
# extraction of thick simple objects

outils = pink.readimage("../images/outils.pgm")
skeleton = pink.skeleton(outils, 0, 8)
#pink.surimp(outils, skeleton, "skeletonized.ppm")
isolated_points = pink.ptisolated(skeleton, 8)
#pink.surimp(skeleton, isolated_points, "ptisolated.ppm")
simple_objects = pink.geodilat(isolated_points, outils, 8)
#pink.surimp(outils, dilated, "dilated.ppm")
eroded = pink.erosball(simple_objects, 10)
thick = pink.geodilat(eroded, outils, 8)
pink.surimp(outils, thick, "thick.ppm")

# sol_outils2
# extraction of thin simple objects
thin = simple_objects - thick
pink.surimp(outils, thin, "thin.ppm")

# sol_outils3
# extraction of object with more than one holes