Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

rgb_to_grayscale (MathScript RT Module Function)

LabVIEW 2010 Help

Edition Date: June 2010

Part Number: 371361G-01

»View Product Info

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.

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, '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