opencv bad alignment hdr imaging

asked 2019-03-20 08:58:11 -0600

rem gravatar image

updated 2020-10-21 04:59:30 -0600

I use opencv 3.4 for android to make HDR image, there is my code :

Mat response = new Mat();
CalibrateDebevec calibrate = Photo.createCalibrateDebevec();
Mat matTimes = new Mat(times.size(), 1, CvType.CV_32F);
float[] arrayTimes = new float[(int) ( * matTimes.channels())];
for (int i = 0; i < times.size(); i++) {
    arrayTimes[i] = times.get(i);
matTimes.put(0, 0, arrayTimes);
calibrate.process(images, response, matTimes);
Mat fusion = new Mat();
MergeMertens mergeMertens = Photo.createMergeMertens();
mergeMertens.process(images, fusion);

Mat ldr = new Mat();
Tonemap tonemap = Photo.createTonemapReinhard(0.2f, 1.0f, 1.0f, 1.0f);
tonemap.process(fusion, ldr);
Core.multiply(ldr, new Scalar(255,255,255), response);

and now there is the result:

image description

as you can see there is a lot of offsets in the red square for exemple why the superposition of pictures is verry bad ?

I try to add the following alignment function before create HDR image but nothing work

AlignMTB alignMTB = Photo.createAlignMTB();
alignMTB.process(images, images);

anybody know how to fix this issue ?

edit retag flag offensive close merge delete