Ask Your Question
0

convert single channel to 3 channel

asked 2017-01-26 22:58:06 -0600

Nbb gravatar image

why cant i convert a single channel mat to a 3 channel mat using convertTo ?

edit retag flag offensive close merge delete

3 answers

Sort by » oldest newest most voted
1

answered 2017-01-27 08:40:59 -0600

Akhilesh gravatar image

updated 2017-01-27 08:42:44 -0600

Hi, as given in the document of opencv, convertTo converts an array to another data type with optional scaling. And it is clearly mentioned that the number of channels of output and input must be same. rtype – desired output matrix type or, rather, the depth since the number of channels are the same as the input has; if rtype is negative, the output matrix will have the same type as the input.

edit flag offensive delete link more
1

answered 2017-01-27 03:05:05 -0600

updated 2017-01-27 03:10:51 -0600

use cvtColor(src,dst,COLOR_GRAY2BGR)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-01-26 22:58:06 -0600

Seen: 14,964 times

Last updated: Jan 27 '17