How to call up Open CV Durand Tonemap function?

1.6k views Asked by At

I'm trying to examine multiple tone-mapping operators in Open CV, using Python.

Various sources use four operators (Drago, Durand, Reinhard, Mantiuk). Three of them work. However, when I call up cv2.createTonemapDurand(), I get this error:

AttributeError: module 'cv2.cv2' has no attribute 'createTonemapDurand'

Is it possible to call the Durand operator somehow, or did Open CV drop that one recently?

Thanks!

2

There are 2 answers

4
Panda50 On

I'll switch from comment to answer to have a better representation.

you just have to :

import cv2

cv2.xphoto.createTonemapDurand()

Be aware that, if u compiled opencv by yourself, you had to check OPENCV_ENABLE_NONFREE.

1
mnikley On

Please post your code where you import cv2 and call the function. If you want to look for some functions, attributes or whatever either look in the documentation of the package or use dir() and type(). For your example you can use this:

import cv2
from re import match

cv2_filtered = filter(lambda v: match('.*Tonemap', v), dir(cv2))
[print(val) for val in cv2_filtered]

Returns:

Tonemap
TonemapDrago
TonemapMantiuk
TonemapReinhard
createTonemap
createTonemapDrago
createTonemapMantiuk
createTonemapReinhard

Seems like there is no function createTonemapDurand in cv2.