Skip to content

strel: more shape generators #75

@johnnychen94

Description

@johnnychen94

Now we have strel_box and strel_window added in #65, the next step is to add a few more basic generators and (perhaps) a high-order generator. Just list a few ideas here:

Basic generators

  • strel_ball/strel_disk: generate a ball-shaped SE. There was a WIP in add connectivity generator helpers #63 for a generic ellipse shape
  • strel_line(sz, degree): generates a line segment along a certain degree
  • strel_octagon
  • strel_star

Unless we know there's room for optimization; we don't need to create new array types like strel_box or strel_diamond does. A plain function that generates plain OffsetArray{Bool} should be sufficient (don't forget that mask SE is centered to zero)

High-order compositor

If we have se1 of dimension N1 and se2 of dimension N2, it would be great to have a function strel_compose(se1, se2, ...) to build a N1+N2 dimension SE.

For instance, I would expect strel_compose(strel_line((3,)), strel_line((3,))) get us a strel_diamond((3, 3)). This might not need to be specific to strel, it can be generalized to a kernel composor since it can also useful for ImageFiltering.

This has two advantages:

  • makes building special SE more easily
  • permits room for optimization via the separable trick. For instance, extreme_filter for diamond SE is implemented this way.

To do the second, we need to build a new array type that is composed of two low-dimensional arrays. This tells Julia enough information to do dispatch.

@ThomasRetornaz I'm unsure which functions I listed above are useful in practice, and I'm not sure if I missed anything. It would be great if you can comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions