Closed annimesh2809 closed 7 years ago
UPDATES:
region_means
has been rectified, the output is much better now (see here).SegmentedImage
type object that carries useful information regarding the segments like segment_means
and segment_pixel_count
along with the array containing the labels.A nice demo:
Original:
After segmentation:
Sweet! That looks really nice!
Docstring and tests have been added!
The improvement can be seen by comparing these to the previous outputs:
Original:
After segmentation (7 labels, 7 seeds):
Original:
After segmentation (2 labels, 8 seeds):
The color of the ith segment corresponds to seg.segment_means[i]
:exclamation: No coverage uploaded for pull request base (
master@582387a
). Click here to learn what that means. The diff coverage is100%
.
@@ Coverage Diff @@
## master #1 +/- ##
=======================================
Coverage ? 100%
=======================================
Files ? 2
Lines ? 95
Branches ? 0
=======================================
Hits ? 95
Misses ? 0
Partials ? 0
Impacted Files | Coverage Δ | |
---|---|---|
src/region_growing.jl | 100% <100%> (ø) |
|
src/core.jl | 100% <100%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 582387a...32b5c9e. Read the comment docs.
I think it is ready to merge.
The travis and appveyor builds are fine with Julia 0.5, although they fail with Julia 0.7 due to LoadError in MacroTools.jl
.
Just wanted to ask, is the field-name img
of SegmentedImage
descriptive enough or should we change it? I could not think of any nice word to describe a map from indices to labels.
labeled_image
comes to mind, although if I understand correctly that might be a bit misleading because it's really the indices to the labels. Would it make sense to bundle both img
and segment_labels
together into an IndirectArray? If you don't want to do that, perhaps image_indexmap
?
And by all means hit "merge" when you are ready.
An Implementation of the Seeded Region Growing Algorithm (Improved version) as explained in this paper. It can currently be used with various color models (like
RGB
,RGBA
,GrayA
etc) and also works with arrays having custom indices (likeOffsetArrays
). Multiple points can be given the same label to indicate that they belong to the same region. Thesrg
function can be used as:Here,
img
is the input imageseeds
is a vector ofTuple{CartesianIndex{2}, Int}
. Each seed corresponds to a point on the image along with a label (which is of typeInt
). This label is used to identify a region uniquely in the segmented image.diff_fn
is a function to calculate δ between a region and a neighboring point.Currently, the output is an array having indices similar to that of the input image. Each point of this array contains a label corresponding to the region to which it belongs. The label can be any of the seed labels or a special value (-4) that corresponds to a point that has same δ value for two (or more) neighbors (boundary tied points).
An example:
Original:![org](https://cloud.githubusercontent.com/assets/15063205/26763215/b3bf8e82-496c-11e7-9499-a4c196747370.png)
After segmentation (before changes):![seg](https://cloud.githubusercontent.com/assets/15063205/26763233/e4187b02-496c-11e7-828a-ace4f4230272.png)
After segmentation (after changes):![seg](https://cloud.githubusercontent.com/assets/15063205/26801300/1330cb7c-4a5a-11e7-99ad-5585b013f430.png)
There are a few things which need to be discussed:
String
,Float
or anything else)where,
img::T
is theresult
array that we get as output now. We can label the tied boundary points as-Inf
or something like that.Once we settle for an API, the documentation and tests could be added.