Ask Your Question
0

stitching_detailed.cpp on grayscale images

asked 2016-08-04 11:40:42 -0500

SSUBA gravatar image

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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-08-04 17:37:25 -0500

Tetragramm gravatar image

You can indeed avoid that part of the code. I'm not sure if everything else will work, but you can create a stitcher object and use the setExposureCompensator to set it to the NoExposureCompensator which has no such assertion.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-08-04 11:40:42 -0500

Seen: 312 times

Last updated: Aug 04 '16