# Pruning on skeleton image in Julia

**URL:** https://discourse.julialang.org/t/pruning-on-skeleton-image-in-julia/91586
**Category:** New to Julia
**Tags:** image-processing
**Created:** [December 13, 2022, 5:25am UTC](https://discourse.julialang.org/t/pruning-on-skeleton-image-in-julia/91586 "2022-12-13T05:25:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![momo1](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@momo1](https://discourse.julialang.org/u/momo1)
#### Post date: [December 13, 2022, 5:25am UTC](https://discourse.julialang.org/t/pruning-on-skeleton-image-in-julia/91586/1 "2022-12-13T05:25:28Z")

</div>

Hi  
I’ve a thinned image from Images.jl thinning(). I’m trying to prune the small branches, I’m not sure how.  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/9/9/9917a6f089973b0a3b0e28da6b6e7632f3ffdf56.png)  
I’ve used harris point detector to get the points on branch ends and on branch-outs. How should the spurs be removed?

---

<div class="post-metadata">

### Author: ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)
#### Post date: [December 13, 2022, 5:49pm UTC](https://discourse.julialang.org/t/pruning-on-skeleton-image-in-julia/91586/2 "2022-12-13T17:49:43Z")

</div>

This seems like a job for Graphs.jl, but I don’t know that package very well. There’s also [GitHub - seung-lab/RealNeuralNetworks.jl: A unified framework for skeletonization, morphological analysis, and connectivity analysis.](https://github.com/seung-lab/RealNeuralNetworks.jl) which may have routines for handling skeletons.

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [January 5, 2023, 8:06am UTC](https://discourse.julialang.org/t/pruning-on-skeleton-image-in-julia/91586/4 "2023-01-05T08:06:38Z")

</div>

From the thinned image, you could try to classify the junctions based on the number of 8-connected neighbors. Then figure out the length of each branch by computing the distance of the end points to the junction pixels.
