我使用opencv 3.4 for android制作HDR图像,这是我的代码:
Mat response = new Mat();
CalibrateDebevec calibrate = Photo.createCalibrateDebevec();
Mat matTimes = new Mat(times.size(), 1, CvType.CV_32F);
float[] arrayTimes = new float[(int) (matTimes.total() * 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);
现在有结果:
如您所见,在红色方块中有很多偏移,例如图片的叠加为什么很差?
我尝试在创建HDR图像之前添加以下对齐功能,但是没有任何作用
AlignMTB alignMTB = Photo.createAlignMTB();
alignMTB.process(images, images);
有人知道如何解决此问题吗?