Draw Result On Image
This function block overlays a textual result on an input image based on a boolean condition. It is useful for annotating pass/fail states, status messages, or any binary result directly onto the image before further processing or display.
π₯ Inputs (sockets)
Image (Input socket) The image that will receive the overlaid text.
Condition (Input socket) A boolean value that determines which text and color will be drawn.
Success Condition Text (Input socket) Text to display when the condition is true.
Fail Condition Text (Input socket) Text to display when the condition is false.
π€ Outputs (sockets)
Image (Output socket) The resulting image with the overlaid text.
πΉοΈ Controls
Font Scale Adjusts the relative font size of the overlaid text to fit different image resolutions.
Horizontal Position Moves the text left/right using a simple 0..10 scale for quick placement.
Vertical Position Moves the text up/down using a simple 0..10 scale for quick placement.
π¨ Features
Visual pass/fail feedback: when the
Conditionis true the block draws theSuccess Condition Textin green; otherwise it draws theFail Condition Textin blue.Resolution-aware sizing: font sizing adapts to image dimensions so text remains readable on different resolutions.
Quick placement: horizontal and vertical sliders provide fast, UI-friendly positioning without manual coordinates.
π Usage Instructions
Provide an image to the
Imagesocket.Feed a boolean signal into the
Conditionsocket to indicate success or failure. You can produce this signal using logic blocks such asLogic Input,Equals,And, orGreater.Optionally provide custom strings to
Success Condition TextandFail Condition Textto control the displayed messages.Adjust
Font Scale,Horizontal Position, andVertical Positioncontrols until the text is placed and sized as desired.Use the output
Imageto continue processing, display with theShow Imageblock, or save withImage Write/Image Logger.
π Evaluation
When evaluated, the block copies the input image, chooses which text to draw based on the Condition socket, renders the text using the selected font scale and position settings, and returns the annotated image through the Image output socket.
π‘ Tips and Tricks
Combine with detection blocks such as
Object Detection,Object Detection - Custom, orMask Detectionto show per-frame OK/NOK results (for example, show "OK" when an object is detected or "Fail" when not).Use
Draw Detectionsin tandem to display bounding boxes and then use this block to add an overall pass/fail label.Use
Image ROIorImage ROI Selectbefore this block to crop to a region of interest and place text relative to that region.If you want to log or save annotated frames, connect the output to
Image Logger,Image Write, orRecord Video.Build complex conditions with logic blocks like
And,Or,Not, or comparisons (Greater,Equals) and feed the final boolean into theConditionsocket.
π οΈ Troubleshooting
No text appears: ensure the
Success Condition TextorFail Condition Textsockets are set (they can be left empty but then nothing will draw).Text placement off-image: adjust
Horizontal PositionandVertical Positionsliders; increase or decreaseFont Scalefor better fit on large or small images.Text too small or too large: tweak
Font Scaleand preview results with theShow Imageblock to find the right balance.
Last updated
Was this helpful?