Draw Line

This function block provides a platform for users to draw lines on an image by clicking with the mouse. It includes the ability to clear drawings and undo the last action.

πŸ“₯ Inputs

Image Any The input image on which lines will be drawn.

Calculate All Points A boolean control that determines if all points on the line should be calculated when a line is drawn.

πŸ“€ Outputs

Image Any The modified image with drawn lines.

Line Coordinates The coordinates of the drawn lines, returned as a list.

Angles The angles of the drawn lines, calculated based on their slope.

πŸ•ΉοΈ Controls

Press 'C' To clear all lines from the image.

Press 'U' To undo the last drawn line.

🎨 Features

Interactive Drawing Users can interactively draw lines by clicking on the image.

Easy Clearing and Undoing The ability to clear all drawings or undo the last action makes it easy to correct mistakes.

Angle Calculation The block computes and returns angles for each drawn line based on the direction.

πŸ“ Usage Instructions

  1. Connect Input Image: Attach an image to the block through the Image Any input.

  2. Draw a Line: Click on the image to draw a line at the clicked position. Each click defines a point of the line.

  3. Clear or Undo: Use the keyboard:

    • Press C to clear all lines.

    • Press U to undo the last drawn line.

  4. Evaluate Output: Run the block to retrieve the modified image, line coordinates, and angles of the drawn lines.

πŸ“Š Evaluation

When evaluated, this block will show the updated image with drawn lines and provide details regarding their coordinates and angles.

πŸ’‘ Tips and Tricks

Drawing Complex Shapes

To create complex shapes, draw multiple lines consecutively by clicking at distinct points on the image.

Utilize Undo Feature

If you make a mistake, make use of the U key to quickly remove the last line before completing your drawing.

Adjusting Line Thickness

You can modify the thickness of the lines by adjusting the line_width value in the code if you want thicker or thinner lines.

Reusable Coordinates

Keep track of the line coordinates; they can help draw the same lines later or for reference in another analysis.

πŸ› οΈ Troubleshooting

No Image Displayed

If no image is displayed, ensure that a valid image has been connected to the input. The block requires an image to show the drawing interface.

Lines Not Visible

Ensure that the drawn lines are not overlapped by other elements. Draw lines on the desired visible areas of the image.

Last updated