🖥
🖥
🖥
🖥
AugeLab Studio Manual
English
Ask or search…
K
Comment on page

Point Polygon Test

Point Polygon Test Node Documentation

The Point Polygon Test node in AugeLab Studio performs a point-in-polygon test to determine if there exists a shape with close boundaries. It tests whether the points of an enclosing contour fall inside or outside a test contour and provides a visual output indicating the test results.

Node Overview

The Point Polygon Test node takes an input grayscale image, a test contour, and an enclosing contour as inputs. It provides the following outputs:
  1. 1.
    Output Image: An image with the test contour and enclosing contour drawn, and points indicating whether they fall inside or outside the test contour.
  2. 2.
    Plot Image: A boolean value indicating whether all points of the enclosing contour fall inside the test contour. True indicates that all points are inside, and False indicates that at least one point is outside.

Node Properties

  • Node Title: Point Polygon Test
  • Node ID: OP_NODE_PPOLYGON_TEST

Inputs

The Point Polygon Test node has the following input sockets:
  1. 1.
    ImageGray: The input grayscale image.
  2. 2.
    Test Contour: The contour to be tested for containment.
  3. 3.
    Enclosing Contour: The enclosing contour defining the boundaries.

Outputs

The Point Polygon Test node has the following output sockets:
  1. 1.
    Output Image: An image with the test contour and enclosing contour drawn, and points indicating whether they fall inside or outside the test contour.
  2. 2.
    Plot Image: A boolean value indicating whether all points of the enclosing contour fall inside the test contour. True indicates that all points are inside, and False indicates that at least one point is outside.

Node Interaction

  1. 1.
    Connect an input grayscale image to the ImageGray input socket of the Point Polygon Test node.
  2. 2.
    Connect a test contour to the Test Contour input socket of the Point Polygon Test node.
  3. 3.
    Connect an enclosing contour to the Enclosing Contour input socket of the Point Polygon Test node.
  4. 4.
    Run the pipeline.
  5. 5.
    The output sockets will provide the output image and the boolean value indicating whether all points of the enclosing contour fall inside the test contour.

Implementation Details

The Point Polygon Test node uses the OpenCV function cv2.pointPolygonTest to perform the point-in-polygon test. It checks whether the points of the enclosing contour fall inside or outside the test contour. The node draws the test contour, enclosing contour, and points on an image to visualize the test results.
The node calculates the distances from each point of the enclosing contour to the test contour using the cv2.pointPolygonTest function. If the distance is greater than 0, the point is outside the test contour. If the distance is less than or equal to 0, the point is inside or on the boundary of the test contour. The node marks the points on the output image accordingly.
The Plot Image output indicates whether all points of the enclosing contour fall inside the test contour. If all points are inside, the output is True, indicating that there is a shape with close boundaries. If at least one point is outside, the output is False, indicating that there is no shape with close boundaries.

Usage

  1. 1.
    Drag and drop the Point Polygon Test node from the node library onto the canvas in AugeLab Studio.
  2. 2.
    Connect an input grayscale image to the ImageGray input socket of the Point Polygon Test node.
  3. 3.
    Connect a test contour to the Test Contour input socket of the Point Polygon Test node.
  4. 4.
    Connect an enclosing contour to the Enclosing Contour input socket of the Point Polygon Test node.
  5. 5.
    Run the pipeline.
  6. 6.
    The output sockets of the Point Polygon Test node will provide the output image and the boolean value indicating whether all points of the enclosing contour fall inside the test contour.

Notes

  • The Point Polygon Test node is useful for testing if there exists a shape with close boundaries by comparing a test contour to an enclosing contour.
  • The output image provides a visual representation of the test results, with the test contour, enclosing contour, and points indicating whether they fall inside or outside the test contour.
  • The boolean output indicates whether all points of the enclosing contour fall inside the test contour. True indicates that all points are inside, and False indicates that at least one point is outside.
  • Ensure that the input grayscale image, test contour, and enclosing contour are correctly connected to the corresponding input sockets of the Point Polygon Test node.
  • The output image and boolean value can be used for further analysis or visualization.
That concludes the documentation for the Point Polygon Test node in AugeLab Studio. Use this node to perform a point-in-polygon test and determine if there exists a shape with close boundaries. The node provides visual feedback and a boolean value indicating the test results.