Skip to content

Manually Segmentation

sankios edited this page Jan 23, 2020 · 1 revision

The module gives all the functions used through the manually segmentation

performance_tool.manually_segmentation.get_image(original: bool = False)

The function return the image on which print the objects. If original is not provided the objects already segmented are shown in light gray color.

  • Parameters

    original (bool) – The parameter specify when return the original image of the image with the already insert polygons.

  • Returns

    The image required is return

performance_tool.manually_segmentation.manually_segmentation()

The function asks the path of the image to segment and the folder in which saves the output json.

The output is a JSON structure in a dictionary. The key is an integer that represent uniquely the object segmented. Each value are the vertices of the polygon used to segment the object.

  • Returns

    A bool value that check if all operations end correctly

  • Return type

    bool

performance_tool.manually_segmentation.plot_all_polygons(pols: [<class 'dict'>], final=False)

The function plot all polygons into the image. If the function is called as final version the image is not shown, otherwise it is printed into a window.

  • Parameters

    • pols (list) – A list containing all the polygon represented as a dictionary

    • final (bool) – Parameter that represent when print the image and return or only return

  • Returns

    Return the image on which all the polygons are printed

performance_tool.manually_segmentation.plot_shape(saving: bool = False)

The function takes care of print the points, line and polygons while the selection

  • Parameters

    saving (bool) – The parameters represent when print the polygons in saving mode (in red colors instead of green).

performance_tool.manually_segmentation.shape_selection(event, x, y, flags, param)

The method is called when the required event is listen through openCV

  • Parameters

    • event – Name of the event

    • x – Position x of the event

    • y – Position y of the event

    • flags – Not used parameter

    • param – Not used parametr