I am working on a C++ project where I need to stitch together multiple 16-bit images which overlap horizontally and vertically, and then save the stitched image. Is there a library which I can use to accomplish this task?
I have tried to use an OpenCV Stitcher object to no success because the following exception was thrown:
terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(4.0.1) /home/rar/opencv_build/opencv/modules/stitching/src/exposure_compensate.cpp:317: error: (-215:Assertion failed) _image.type() == CV_8UC3 in function 'apply'
Here is my code snippet which performs the stitching:
// vector containing 16-bit images std::vector<cv::UMat> images; cv::Ptr<cv::Stitcher> stitcher = cv::Stitcher::create(); cv::UMat stitched; cv::Stitcher::Status status = stitcher->stitch(images, stitched); // Performs the image stitching and outputs a status
Other people seem to have faced the same problem as I have [https://answers.opencv.org/question/34795/stitching-16bits-greyscale-images/]