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

rgb_to_grayscale (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info
Download Help (Windows Only)

Owning Class: support

Requires: MathScript RT Module

Syntax

b = rgb_to_grayscale(a)

Legacy Name: rgb2gray

Description

Converts an RGB image to grayscale.

Examples

Inputs

Name Description
a Specifies a real matrix.

Outputs

Name Description
b Returns the grayscale representation of the image. b is the same size as a.

Details

The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes
Supported on RT targets Yes
Suitable for bounded execution times on RT Not characterized

Examples

[X, Y] = meshgrid2d(-1:0.01:1);
R = (2-X.^2-Y.^2)*255/2;
G = cos(X*pi/2).*255;
B = cos(Y*pi/2).*255;
image = R*255*255+G*255+B;
fwrite_image(image, '/images/reference/en-XX/help/373123C-01/imagetest.bmp', 'BMP');
gray = rgb_to_grayscale(image);
surface(gray);
colormap([0, 0, 0; 1, 1, 1]);

Related Topics

fread_image
fwrite_image


 

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