Segmentation & Contours

Segmentation Filters #

From the View menu you can select to view either:

  • Image
  • Threshold
  • Threshold Inverted
  • Sobel Filter
  • Canny Filter

Each filter’s parameters can be changed through controls provided in the properties panel; you may need to scroll down to see them. These filters have been written to work with extraordinary performance for a mobile device. You can experiment with the filters’ parameters and see the results update in real time.

Once the image has been segmented you can also choose to generate contours around the segments. Each contour can be displayed as either a Region (bounding box), its Convex Hull and a Rotated Region. When contours are being generated the behaviour for creating boxes changes allowing you to create boxes by tapping on a contour’s region.

This displays the original image along with any boxes.

This is an adaptive threshold filter which segments the image. This filter uses varying levels of thresholding the segmentation depending on the grey level variance of surrounding pixels in a given window. The size of the window can be changed along with a threshold weight parameter. Experimentation with the Window Size and Threshold Weight will vary the sensitivity of the filter.

Threshold Inverted
This applies the same adaptive threshold filter but after inverting the original image. Depending on the content of the image it may offer better segmentation.

Sobel Filter
This just displays the image with a Sobel filter applied. Because of the nature of Sobel contours are not generated and there is no control over the filter. Tap for further information on the Sobel operator.

Canny Filter
This applies the Canny filter to the image and can also generate contours. The Canny filter can be controlled Tap for further information on the Canny edge detector.

Contours #

ToolZ can generate contours from images that have been segmented. Each contour is created by tracing around the white pixels against a black background.

  • Toggle the Generate Contours switch to turn on the contours.
    The contours are only created for segments where their boundary exceeds a given threshold, this is to eliminate generating contours for just noise. The default value is 100 pixels.
  • Change the Minimum Boundary parameter to decrease / increase the number of contours generated.

The contours can be displayed with any of the following options:

  • Show Region
    This is the bounding box for the contour and is displayed in blue.
  • Show Convex Hull
    This is the convex hull for the contour and is displayed in red.
  • Show Rotated Region
    This is a rotated rectangle for the contour and is displayed in green.

Since ToolZ only creates rectangular boxes the blue regions are currently the most meaningful type of display.

Creating boxes from regions:

  • Tap within a blue region to create a box of the currently selected label.
    This can make creating boxes extremely efficient and accurate once you have your threshold parameters set to match the objects in the image.

Contracting boxes to the threshold:
If you have already boxed objects within your image, ToolZ can help to fit those boxes exactly around a thresholded segment.

  • Select the box to contract
  • From the Edit menu choose the Contract Boxes To Threshold item.