Get Pixel

This function block reads the color value at a specific image coordinate and returns it for further use. It supports both color (BGR) and grayscale images and validates the supplied coordinate before sampling.

πŸ“₯ Inputs

Image Any Main image to sample from

Point Coordinate of the pixel to read (format: (x, y))

πŸ“€ Outputs

(Blue, Green, Red) Pixel value read at the given coordinate.

  • For color images this is the B, G, R channels returned together.

  • For grayscale images a single-channel value is returned.

πŸ•ΉοΈ Controls

This block has no interactive controls or widgets.

🎨 Features

  • Simple pixel sampling by coordinate.

  • Works with color (BGR) and grayscale images.

  • Input validation with clear error messaging when the image is invalid or the coordinate is outside image bounds.

  • Returns values in a format ready to connect to other blocks that accept pixel or numeric data.

βš™οΈ Running mechanism

  • The block reads the image from the first input socket and the coordinate from the second socket.

  • If the image or coordinate is invalid, the block reports an error to help you correct inputs.

  • If valid, the block samples the pixel at the given (x, y) position and outputs its channel values.

πŸ“ Usage instructions

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

  2. Provide a coordinate to the Point input. Coordinates are provided as (x, y).

  3. Use the (Blue, Green, Red) output where needed (for display, comparison, logging, etc.).

πŸ’‘ Tips and Tricks

  • Combine with Get Pixel Mouse to pick coordinates interactively by clicking on the image.

  • Use Show Image to preview the image while you choose sampling coordinates.

  • Visualize the sampling location by sending the coordinate to Draw Point so you can confirm the correct pixel is being read.

  • Crop the image first with Image ROI or Image ROI Select to restrict sampling to a region of interest and avoid out-of-bounds coordinates.

  • Validate that a point is inside a selected area using Check Area before sampling to avoid errors.

  • Log or export sampled values using Image Logger or CSV Export for later analysis.

πŸ› οΈ Troubleshooting

  • If you see an error about the image input, ensure the connected block actually provides an image and that the data is not empty.

  • If you see an error about the coordinate, check that the (x, y) values are integers and lie within the image width and height.

  • When sampling from a grayscale image, expect a single-channel value rather than three channel values.

Last updated

Was this helpful?