Skip to content

Keep linked Contours

Description

Keeps contours related to the main object, removes the others.
Needs to be part of a pipeline where a mask has already been generated.
Contrary to Keep biggest contours it can merge divided objects.

Real time: False

Usage

  • Mask cleanup: Cleans a coarse mask generated by threshold tools

Parameters

  • Allowed distance to main contour (tolerance_distance): (default: 100)
  • Min contour area size (tolerance_area): (default: 5000)
  • Root contour position (root_position): (default: BOTTOM_CENTER)
  • Erosion/dilation iterations (kernel size 3) (dilation_iter): (default: 0)
  • Include all contours bigger than (area_override_size): (default: 0)
  • Delete all contours smaller than (delete_all_bellow): The more small contours are delete, the faster the algorithm (default: 0)
  • Pseudo color channel (channel): (default: l)

Example

Parameters/Code

Default values are not needed when calling function

1
2
3
4
5
from ipapi.ipt import call_ipt

mask = call_ipt(ipt_id="IptKeepLinkedContours",
                source="arabido_sample_plant.jpg",
                )

Result

Result image