<< Input output Input output imread >>

scicv >> Input output > cvtColor

cvtColor

Converts an image from one color space to another.

Syntax

img_out = cvtColor(img_in, code[, nchannels])

Parameters

img_in

Input image (Mat).

code

Color space conversion code (double matrix).

nchannels

number of channels of the output image (double matrix) (default 0, the number of channels is deduced from the input image and the code).

img_out

Output image (Mat).

Description

cvtColor convert an input image from one color space to another.

The conversion code name format is CV_<colorspace_src>2<colorspace_dst>. Some typical examples:

Examples

scicv_Init();

img = imread(getSampleImage("lena.jpg"));

img_gray = cvtColor(img, CV_BGR2GRAY);

matplot(img_gray);

delete_Mat(img);
delete_Mat(img_gray);

Report an issue
<< Input output Input output imread >>