# Revision history [back]

### stitching_detailed.cpp on grayscale images

I'm trying to use stitching_detailed.cpp example for 16-bit tiff grayscale images. When I input two grayscale images, I get the following assertion problem:

OpenCV Error: Assertion failed (image.type() == CV_8UC3) in cv::detail::BlocksGainCompensator::apply, file ..\..\..\modules\stitching\src\exposure_compensate.cpp, line 227


I assume that the above error shows that the compensator block requires 3 channels, whereas my image has only one channel.

I changed the two instance of the following code:

full_img = imread(img_names[i]);


to

full_img = imread(img_names[i]);
cvtColor(full_img, full_img, CV_BGR2GRAY);


I have the following questions: 1. Is there any way I can use stitching_detailed.cpp for grayscale images (especially 16-bit tiffs). 2. If not, I was thinking of converting my gray scale images to color images and then using them for the stitching_detailed.cpp. How can we convert a gray scale image to color image.