Ask Your Question
0

convert single channel to 3 channel

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

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 -0500

Akhilesh gravatar image

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

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 -0500

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

use cvtColor(src,dst,COLOR_GRAY2BGR)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

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

Seen: 3,078 times

Last updated: Jan 27 '17