Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
2 ratings:
 3 out of 5   

Thresholding a Grayscale Image and its Effects on Machine Vision Operations

Primary Software:
Primary Software Version: 7.0
Primary Software Fixed Version: N/A
Secondary Software: Vision Development Module

In Vision Assistant, why do some of my Machine Vision operations not work after thresholding a grayscale image?

With default settings, most Machine Vision operations do not work on thresholded images. This is because thresholding changes a grayscale image to a binary image, i.e. the range of pixel values goes from [0, 255] to [0,1]. This is visually represented by a black (for pixel value 0) and red (for pixel value 1) image in NI-Vision. Since most machine vision operations expect grayscale images, certain settings need to be changed to make these operations work. 

Here are some operations and the changes required to make them work for thresholded images:

Class of Operation: Edge Detection / Gauging operations

Solution: Change Edge Strength to 1

Principle: These operations look for edges (step changes in gray level) of a particular edge strength in an image. Since thresholding changes the dynamic range of the image pixels from [0, 255] to [0, 1], the image now has edges of strength 1- the transition from black to white (red in NI Vision) or vice versa. The default value of edge strength is typically higher for these steps and needs to be changed to 1.

Procedure: In the step configuration menu look for Edge Strength or Min Edge Strength and change the value to '1'.


Class of Operation: Pattern Matching / Golden Template

Solution: Change dynamic rage back to [0, 255]

Principle: Pattern matching operations work only on grayscale images. As such, it is not possible to create a template from a binary image. To get these operations to work, you have to convert the binary image back to a grayscale image.

Procedure: Navigate to the Grayscale Operations palette and select the Lookup Table step; then choose the Equalize operation. The result of his step is a grayscale image.

Related Links:
KnowledgeBase 3RBCAHHB: What Algorithms Does the NI Vision Software Use?
KnowledgeBase 3FDHO5CH: IMAQ Vision Algorithms


Report Date: 10/17/2008
Last Updated: 04/04/2012
Document ID: 4QGI9Q1S

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit