Conversion of channel 3 to channel 1

asked 2017-08-22 06:00:22 -0500

vps gravatar image

updated 2017-08-22 06:00:55 -0500

Hi All, I have depth data stream. I am getting the data type of of video stream is 16 which is CV_8UC3. How to convert this channel 3 to channel 1? and also, This video stream contains only the normalized depth data. So, how type is 16?

Thank you.

edit retag flag offensive close merge delete

Comments

You are looking for this.

E.g.:
cv::Mat ThreeChannel;
cv::Mat OneChannel;
cv::cvtColor(ThreeChannel, OneChannel, CV_BGR2GRAY); //if your input image is another formate change the flag
Ice_T02 gravatar imageIce_T02 ( 2017-08-22 08:23:17 -0500 )edit

Thank for your comment. I am not sure but cvtcolor may not work in this case because data is a depth. But I got the other solution. As I am getting the 3 same channels which contain the normalized depth data. So, I use "spilt" function to extract one matrix only.

vps gravatar imagevps ( 2017-08-22 15:57:46 -0500 )edit