Count Pixels in Grayscale Scale

You are currently viewing the documentation for the latest version (2.2.0). To access a different version, click the "Switch version" button located in the upper-right corner of the page.

■ If you are not sure which version of the product you are currently using, please feel free to contact Mech-Mind Technical Support.

Description

This Step is used to count the number of pixels within the specified region of a grayscale image that fall within the defined grayscale threshold ranges.

Usage Scenario

This Step is applicable to scenarios where the number of pixels in a specified grayscale range in an image or a specified region needs to be counted.

For example, it can track pixel count changes in bright spots, dark spots, or specific grayscale regions, determine the proportion of a given grayscale class within the target region, or provide a quantitative basis for thresholding results.

Workflow

The process of configuring this Step is shown below:

workflow
  1. Configure the input. Connect the Step ports in the graphical programming workspace or select the input under Input in the parameter configuration panel.

  2. Set the ROI.

  3. Set one or more grayscale threshold ranges.

  4. Select the output items in the Output section, and set the acceptable range for the output items.

  5. Run the Step and view output.

Input Description

Input item Description

Grayscale Image

The grayscale image used for pixel counting.

Alignment Parameter Group

Optional input. Used to adjust the pose of the ROI synchronously based on the pose transformation of the target object.

Parameter Description

Parameter Description

ROI Settings

This parameter is used to set the image area for pixel counting. When the Step is executed, only the number of pixels whose grayscale values fall within the set threshold in the ROI will be counted.

See 2D ROI Settings to learn how to set and adjust the ROI.

Threshold range

This parameter defines one or more closed-interval grayscale ranges. When the input grayscale image is counted as pixels, the number of pixels falling within these ranges will be counted.

When multiple ranges are set, overlapping grayscale values do not result in duplicate pixel counts.

Output Description

Output item Description

Mask

A single-channel binary image generated by thresholding. Pixels with gray values within the specified threshold ranges are set to 255 (white), while others are set to 0 (black).

Pixel Count

The number of pixels with gray values within the specified threshold ranges.

Troubleshooting

For common errors, see Error Code List.

Is this page helpful?

You can give a feedback in any of the following ways:

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.