2

I'm currently trying to do some HDR processing with OpenCV's python wrapper.

import cv2
import numpy as np

img = cv2.imread("1.jpg")
img2 = cv2.imread("2.jpg")
img3 = cv2.imread("3.jpg")

images = [img, img2, img3]
times = [-2, 0, 2]

response = np.zeros(256)
import ipdb; ipdb.set_trace()
calibrate = cv2.createCalibrateDebevec()
calibrate.process(images, response, times)

ipdb> calibrate.process(images, response, times)
*** TypeError: dst is not a numpy array, neither a scalar

It says that dst or 'response' in my code based on the position is not an numpy array but checking the type of 'response', it clearly says it is.

ipdb> type(response)
<type 'numpy.ndarray'>
Kent Shikama
  • 3,910
  • 3
  • 22
  • 55

1 Answers1

1

You should use call

calibrate.process(images, times, response)

or

response = calibrate.process(images, times)

instead of

calibrate.process(images, response, times)

because python CalibrateDebevec's process member signature is the following:

process(src, times[, dst]) -> dst

It can be simply determined with the following:

import inspect
print(inspect.getdoc(calibrate.process))
avtomaton
  • 4,725
  • 1
  • 38
  • 42
  • Ahh yes. For some reason I was convinced that the signature was process(src, dst, times). Thanks! – Kent Shikama Dec 23 '15 at 10:00
  • I am having an issue with the same HDR processing problem (although for different reasons). If you can, it would be nice if you could take a look: http://stackoverflow.com/questions/34433906/opencv-python-createmergedebevec-returns-an-array-of-inf – Kent Shikama Dec 23 '15 at 10:49