Example Code

IMAQ: Grayscale to Black and White Using Arrays

Code and Documents

Attachment

Introduction

This VI uses a 2D array of pixel values between 0 and 255.  The array is converted to an image and displayed.  It, also, checks the pixel value and compares it to a threshold specified by the user.  All pixel values below the threshold are set to 0 (black) and all values about the threshold are set to 255 (white).  The array is then converted to an image and displayed.

Steps to Complete

Enter values between 0 and 255 into the array.  Specify a threshold.  Run the VI.

Additional Notes

None.

grayscale to black and white block diagram.png

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors