Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

HDR fusion (Mertens) gives different results in Python Vs. C++

$
0
0
When I run the HDR Mertens exposure fusion in Python I get weird colors artifact, that I don't get when I run the exact same function in c++. (I just run the [HDR Tutorial](http://docs.opencv.org/master/d3/db7/tutorial_hdr_imaging.html#gsc.tab=0)) Seems to me like some problem with the data types, but I tried every option and nothing works. Am I doing something wrong? I'm running Python 3.5 64-bit with OpenCV 3.0.0. **The exposures images were taken from Wikipedia:** [1/30 sec](https://upload.wikimedia.org/wikipedia/commons/thumb/0/09/StLouisArchMultExpEV-4.72.JPG/640px-StLouisArchMultExpEV-4.72.JPG), [1/4 sec](https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/StLouisArchMultExpEV-1.82.JPG/640px-StLouisArchMultExpEV-1.82.JPG), [2.5 sec](https://upload.wikimedia.org/wikipedia/commons/thumb/8/89/StLouisArchMultExpEV%2B1.51.JPG/640px-StLouisArchMultExpEV%2B1.51.JPG), [15 sec](https://upload.wikimedia.org/wikipedia/commons/thumb/8/8f/StLouisArchMultExpEV%2B4.09.JPG/640px-StLouisArchMultExpEV%2B4.09.JPG). **The Python code:** import cv2 import numpy as np img_fn = ["640px-StLouisArchMultExpEV+4.09.jpg", "640px-StLouisArchMultExpEV+1.51.jpg", "640px-StLouisArchMultExpEV-1.82.jpg", "640px-StLouisArchMultExpEV-4.72.jpg"] img_list = [cv2.imread(fn) for fn in img_fn] # Exposure fusion using Mertens mergeMertens = cv2.createMergeMertens() resFusion = mergeMertens.process(img_list) # Convert datatype to 8-bit and save resFusion_8bit = np.uint8(resFusion*255) cv2.imwrite("fusion.png", resFusion_8bit) **The result I get in Python:** ![image description](/upfiles/14493962298320027.png) **The result I get in C++:** ![image description](/upfiles/14493964866086107.png)

Viewing all articles
Browse latest Browse all 41027

Trending Articles