For the complete documentation index, see llms.txt. This page is also available as Markdown.

Perspective Transform

This function block lets you define a quadrilateral region on an image and generate a corrected, top-down (perspective‑transformed) view of that region. It is interactive β€” select four points on the image, drag them to refine, and use keyboard shortcuts to edit your selection.

πŸ“₯ Inputs

  • Image β€” Source image shown inside the block for point selection.

πŸ“€ Outputs

  • Image β€” The perspective-transformed (warped) image of the selected quadrilateral.

  • Transform Matrix β€” The perspective transform matrix (useful to feed other blocks that require a perspective or homography matrix).

πŸ•ΉοΈ Controls

  • Interactive Image Area β€” Click on the image to add points. Points are shown as an overlay polygon as you add them.

  • Drag Points β€” Click and drag a point to adjust its position.

  • C β€” Clear all selected points.

  • U β€” Undo the last added point.

  • Help Text β€” Small on-block instructions reminding you how to add, drag, clear, and undo points.

Note: The overlay will indicate whether the polygon is complete and highlights the vertex under the mouse for easier adjustment.

βš™οΈ Running Mechanism

  • The block displays the connected image so you can interactively pick four points.

  • If fewer than four points are defined the block returns empty outputs so downstream blocks know the transform is not ready.

  • Once four points are provided the block orders them, computes the output rectangle size from the selected points, builds a perspective transform, and outputs the warped image together with the transform matrix.

  • The block caches the last computed transform for the same image and point set to avoid unnecessary recomputation while adjusting other parts of the scenario.

✨ Features

  • Interactive, visual ROI selection with click-and-drag editing.

  • Keyboard shortcuts for fast editing.

  • Visual overlay shows polygon, vertex highlight, and completion state.

  • Outputs both the corrected image and the transform matrix for reuse.

  • Automatic sizing chooses an appropriate output rectangle based on the selected points.

πŸ“ Usage Instructions

  1. Connect an image-producing block to Image input.

  2. Click on the image area inside the block to set up to four corner points (any order).

  3. Drag points to fine-tune their locations.

  4. Use U to undo the last point and C to clear all points.

  5. When four points are present the block will provide a corrected image and the Transform Matrix output.

πŸ’‘ Tips and Tricks

  • Use Show Image to preview the source or transformed image in a larger viewer window while you fine-tune the points.

  • If you need to crop the area first, add Image ROI Select or Image ROI before this block so you work on a smaller region.

  • If your source image is very large, add Image Resizer before this block to speed up interaction and reduce memory use.

  • The produced Transform Matrix can be fed into the Social Distance Detector block as the required Perspective Matrix input to enable real-world distance measurements from the warped view.

  • Save transformed results with Image Write if you want to keep a copy of the corrected images.

πŸ› οΈ Troubleshooting

  • If no output appears, ensure four points are defined β€” the block will not produce a transform until the quadrilateral is complete.

  • If the warped image looks skewed, adjust the corner points by dragging them; using Show Image helps to inspect details while tuning.

  • If interaction feels slow on large images, insert Image Resizer before this block or work on a cropped region with Image ROI Select.

  • If you accidentally add a point in the wrong place, press U to remove the last point or C to start over.

Last updated