Perspective Transform

This function block allows users to apply a perspective transformation to an image by selecting four points. These points define a rectangular area in the input image that will be transformed to fit a given target rectangle.

📥 Inputs

Image Any The input image that you want to apply the perspective transformation on.

📤 Outputs

Image Any The output image after applying the perspective transformation.

Transform Matrix The matrix used for the perspective transformation, useful for understanding how the transformation has been applied.

🕹️ Controls

Mouse Clicks Click on the image displayed in the block to define four points for the perspective transformation in a clockwise order starting from the bottom left corner.

Keyboard Controls

  • Press C to clear the existing points.

  • Press U to undo the last point added.

🎨 Features

Interactive User Input Users can interactively select points on the image using mouse clicks, allowing for easy adjustments.

Visual Feedback The points and lines drawn on the image provide immediate visual feedback, helping users understand how the transformation will occur.

📝 Usage Instructions

  1. Input an Image: Connect an image to the input of the block.

  2. Select Four Points: Click on the image to define four corners of the region you want to transform in a clockwise manner starting from the bottom left.

  3. Clear or Undo: If you make a mistake, you can press C to clear all points or U to undo the last point.

  4. Evaluate: Run the block to perform the perspective transformation. The output image will reflect the transformation, and the matrix will be available for further usage.

📊 Evaluation

When evaluated, this function block returns the transformed image based on the points selected and the corresponding transformation matrix.

💡 Tips and Tricks

Defining Points Accurately

For the best results, ensure the points are defined accurately, especially on non-rectangular shapes. Take your time clicking to ensure each point is as close to the desired location as possible.

Using an Image Resizer

If the image size is too large and affects performance, consider using the Image Resizer function block before applying the perspective transformation.

Cropping Before Transforming

If you only need to transform a specific area, use Image ROI to crop the area first before applying the perspective transformation to improve focus and performance.

🛠️ Troubleshooting

No Points Registered

If nothing seems to be drawn on the image, ensure you are clicking on the correct area and that you have allowed enough time for the draw action to respond before moving on.

Transformation Result Does Not Appear Correct

Double-check that the points were selected in the correct order and are defining a valid rectangle. If points are too close together or not positioned correctly, the outcome may not be as expected.

Last updated