Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Create Mask VI

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

Owning Palette: Picture Functions VIs

Requires: Base Development System

Applies a mask to an image and returns the mask information in the mask element of image data. This VI is useful if you want to make a certain color in an image transparent before writing the image to a 2D picture control.

Details  Example

image data describes the image you want to draw or manipulate.
image type is reserved for future use.
image depth specifies the color depth of the image, which is the number of bits to use to describe the color of each pixel in the image. Valid values include 1, 4, 8, and 24 bits per pixel. image depth affects how LabVIEW interprets the values of image and colors.
image is an array of bytes that describes the color of each pixel in the image in raster order. The value of image depth determines how LabVIEW interprets the value of this input. If image depth is 24, each pixel has three bytes to describe its color. The first byte for each pixel describes the red value, the second byte describes the green value, and the third byte describes the blue value.

If image depth is 8, each pixel has one byte to describe its color. The value of each byte corresponds to an element in colors, which stores 32-bit RGB values where the most-significant byte is zero, followed in order by red, green, and blue values. Valid values include 0 through 255.

If image depth is 4, the behavior is similar to when image depth is 8 except valid values in image include 0 through 15.

If image depth is 1, any value of zero in image corresponds to element 0 in colors. All other values correspond to element 1 in colors.
mask is an array of bytes in which each bit describes mask information for a pixel. The first byte describes the first eight pixels, the second byte describes the next eight pixels, and so on. If a bit is zero, LabVIEW draws the corresponding pixel as transparent. If the array is empty, LabVIEW draws all pixels without transparency. If the array does not contain a bit for each pixel in the image, LabVIEW draws any pixels missing from the array without transparency.
colors is an array of RGB color values that correspond to the values in image. The value of image depth determines how LabVIEW interprets the value of this input. colors stores 32-bit RGB values where the most-significant byte is zero, followed in order by red, green, and blue values. Valid values include 0 through 255.

If image depth is 24, LabVIEW ignores this input.

If image depth is 8, the array can have 256 elements.

If image depth is 4, the array can have 16 elements.

If image depth is 1, the array can have 2 elements.
Rectangle is a cluster that contains coordinates that describe the bounding rectangle in which you want to draw the image. The VI clips the image to the width and height of the rectangle. The bottom and right edges of the rectangle bounds do not contain image pixels. Horizontal coordinates increase to the right, and vertical coordinates increase to the bottom.
left is the horizontal coordinate of the left edge of the rectangle.
top is the vertical coordinate of the top edge of the rectangle.
right is the horizontal coordinate of the right edge of the rectangle.
bottom is the vertical coordinate of the bottom edge of the rectangle.
Mask Color is the color in the image you want to appear transparent for 24-bit, 8-bit, and 4-bit images. You can wire a color box constant to this input.
If 1-Bit Mask Value is TRUE (default), the VI draws all elements in the image array with an index of 1 as transparent. If FALSE, the VI draws all elements with an index of 0 as transparent. The VI ignores this input if image data does not describe a 1-bit image.
If Combine Masks? is TRUE, the VI combines any existing mask information for the image and the mask information you wire to this VI and applies all the mask information to the image. If FALSE (default), the VI applies only the mask information you wire to this VI.
image data returns information about the image so you can use the Draw Flattened Pixmap VI to draw it as a picture.
image type is reserved for future use.
image depth specifies the color depth of the image, which is the number of bits to use to describe the color of each pixel in the image. Valid values include 1, 4, 8, and 24 bits per pixel. image depth affects how LabVIEW interprets the values of image and colors.
image is an array of bytes that describes the color of each pixel in the image in raster order. The value of image depth determines how LabVIEW interprets the value of this output.

If image depth is 24, each pixel has three bytes to describe its color. The first byte for each pixel describes the red value, the second byte describes the green value, and the third byte describes the blue value.

If image depth is 8, each pixel has one byte to describe its color. The value of each bit corresponds to an element in colors, which stores 32-bit RGB values where the most significant byte is zero, followed in order by red, green, and blue values. Valid values include 0 through 255.

If image depth is 4, the behavior is similar to when image depth is 8 except valid values in image include 0 through 15.

If image depth is 1, any value of zero in image corresponds to element 0 in colors. All other values correspond to element 1 in colors.

The size of the array might be larger than expected due to padding.
mask is an array of bytes in which each bit describes mask information for a pixel. The first byte describes the first eight pixels, the second byte describes the next eight pixels, and so on. If a bit is zero, LabVIEW draws the corresponding pixel as transparent. If the array is empty, LabVIEW draws all pixels without transparency. If the array does not contain a bit for each pixel in the image, LabVIEW draws any pixels missing from the array without transparency.
colors is an array of RGB color values that correspond to the values in image. The value of image depth determines how LabVIEW interprets the value of this output.

If image depth is 24, LabVIEW ignores this output.

If image depth is 8, the array can have 256 elements.

If image depth is 4, the array can have 16 elements.

If image depth is 1, the array can have 2 elements.

If the array is empty for any depth other than 24 bits per pixel, the image is using the default LabVIEW color palette.
Rectangle is a cluster that contains coordinates that describe the bounding rectangle of the image. Horizontal coordinates increase to the right, and vertical coordinates increase to the bottom.
left is the horizontal coordinate of the left edge of the rectangle.
top is the vertical coordinate of the top edge of the rectangle.
right is the horizontal coordinate of the right edge of the rectangle.
bottom is the vertical coordinate of the bottom edge of the rectangle.

Create Mask Details

Use the Flatten Pixmap VI to convert a pixmap to a cluster you can wire to image data. If the image is 4-bit, 8-bit, or 24-bit, wire a color to the Mask Color input. If the image is 1-bit, wire a value to the 1-Bit Mask Value input.

Example

Refer to the Using Mask with Picture VI in the labview\examples\Graphics and Sound\2D Picture Control directory for an example of using the Create Mask VI.


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit