Comment on page
Point Polygon Test
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.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.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.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 Title: Point Polygon Test
- Node ID: OP_NODE_PPOLYGON_TEST
The
Point Polygon Test
node has the following input sockets:- 1.ImageGray: The input grayscale image.
- 2.Test Contour: The contour to be tested for containment.
- 3.Enclosing Contour: The enclosing contour defining the boundaries.
The
Point Polygon Test
node has the following output sockets:- 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.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.
- 1.Connect an input grayscale image to the ImageGray input socket of the
Point Polygon Test
node. - 2.Connect a test contour to the Test Contour input socket of the
Point Polygon Test
node. - 3.Connect an enclosing contour to the Enclosing Contour input socket of the
Point Polygon Test
node. - 4.Run the pipeline.
- 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.
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.- 1.Drag and drop the
Point Polygon Test
node from the node library onto the canvas in AugeLab Studio. - 2.Connect an input grayscale image to the ImageGray input socket of the
Point Polygon Test
node. - 3.Connect a test contour to the Test Contour input socket of the
Point Polygon Test
node. - 4.Connect an enclosing contour to the Enclosing Contour input socket of the
Point Polygon Test
node. - 5.Run the pipeline.
- 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.
- 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.