I separate BGR channels and operate on each channel and finally want to merge
the enhanced BGR channels together into the output image. But the following error occurs.
/* Final Image */
vector<Mat> finalImgCh(3);
Mat finalImage(src.size(), CV_8UC3);
finalImgCh.push_back(Norm_b); // image type = CV_8UC1
finalImgCh.push_back(Norm_g);
finalImgCh.push_back(Norm_r);
merge(finalImgCh, finalImage);
namedWindow("Final Enhanced Image", WINDOW_FREERATIO);
imshow("Final Enhanced Image", finalImage);
waitKey(0);
Expected result: Want to get the final colour image with image type CV_8UC3
.
Acutal resutl:
OpenCV(3.4.1) Error: Assertion failed (mv[i].size == mv[0].size && mv[i].depth() == depth) in cv::merge, file c:\opencv\3.4.1\opencv-3.4.1\modules\core\src\merge.cpp, line 458