c++ - Why ExposureCompensator gives black image as result? -
i trying use exposurecompensator
class. trying paste small image bigger image before pasting want balance brightness of 2 images. when run code, smallimage
return black image.
ps: also, if use exposurecompensator::gain_block
gives error, integer division zero.
int num_images = 2; int img_idx = 1; //left , top corner position of small image int left = 300; int top = 400; vector<point> corners(num_images); vector<mat> images_warped(num_images); vector<mat> masks_warped(num_images); images_warped.push_back(bigimage); images_warped.push_back(smallimage); corners.push_back(point(0, 0)); corners.push_back(point(left, top)); //created 2 white mats masks mat bigmask, smallmask; bigmask.create(bigimage.size(), cv_8u); bigmask.setto(scalar::all(255)); smallmask.create(smallimage.size(), cv_8u); smallmask.setto(scalar::all(255)); masks_warped.push_back(bigmask); masks_warped.push_back(smallmask); int expos_comp_type = detail::exposurecompensator::gain; ptr<detail::exposurecompensator> compensator = detail::exposurecompensator::createdefault(expos_comp_type); compensator->feed(corners, images_warped, masks_warped); compensator->apply(img_idx, corners[img_idx], smallimage, smallmask);
if create vector objects in codes:
vector<point> corners(num_images); vector<mat> images_warped(num_images); vector<mat> masks_warped(num_images);
the size of objects 2. after push_back()method ,the size 4.
try replace codes above to:
vector<point> corners(0); vector<mat> images_warped(0); vector<mat> masks_warped(0);
Comments
Post a Comment