# Histogram equalization with OpenCV

**URL:** <https://discourse.julialang.org/t/histogram-equalization-with-opencv/126421>\
**Category:** Signal and Image Processing\
**Tags:** opencv\
**Created:** [February 28, 2025, 12:36pm UTC](https://discourse.julialang.org/t/histogram-equalization-with-opencv/126421 "2025-02-28T12:36:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Post date:** [February 28, 2025, 12:36pm UTC](https://discourse.julialang.org/t/histogram-equalization-with-opencv/126421/1 "2025-02-28T12:36:43Z")

</div>

I am using OpenCV.jl for image processing and I want to increase the contrast of an image using [adaptive histogram equalization](https://docs.opencv.org/4.x/d5/daf/tutorial_py_histogram_equalization.html). I can create the CLAHE object with `OpenCV.createCLAHE`, but that is an “C++ smart pointer of type `OpenCV.cv_PtrAllocated{OpenCV.CLAHE}`”, but I have no idea about how to use it.

I have found in [this discussion](https://discourse.julialang.org/t/julia-images-adaptive-histogram-equalization-vs-matlabs-implementation/119469) that ImageContrastAdjustment.jl also allows to do it, but I would like to know if OpenCV - which I am already using - might be sufficient, without having to add more dependencies to the project.

---

<div class="post-metadata">

**Author:** ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Post date:** [March 1, 2025, 8:48am UTC](https://discourse.julialang.org/t/histogram-equalization-with-opencv/126421/2 "2025-03-01T08:48:18Z")

</div>

To give a bit of more context: OpenCV’s [CLAHE class](https://docs.opencv.org/3.4/d6/db6/classcv_1_1CLAHE.html) has the method `apply` - and Python’s binding also uses it, according to the documentation.

Now, according to the [tutorial for the Julia OpenCV binding](https://docs.opencv.org/4.x/d8/da4/tutorial_julia.html) “because Julia does not support OOP paradigm some changes had to be made. To access functions like `obj.function(ARGS)` you should instead use `function(obj, ARGS)`” Thus, I would expect a method `OpenCV.apply` for the output of `OpenCV.createCLAHE`, but the name `OpenCV.apply` does not even exist.

---

<div class="post-metadata">

**Author:** ![csvance](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/csvance/32/218927_2.png) [@csvance](https://discourse.julialang.org/u/csvance)\
**Post date:** [June 11, 2025, 11:42am UTC](https://discourse.julialang.org/t/histogram-equalization-with-opencv/126421/3 "2025-06-11T11:42:13Z")

</div>

I ran into the same issue. My guess is the function needs to be added here: [opencv\_contrib/modules/julia/gen/jl\_cxx\_files/cv\_manual\_wrap.jl at 4.x · opencv/opencv\_contrib · GitHub](https://github.com/opencv/opencv_contrib/blob/4.x/modules/julia/gen/jl_cxx_files/cv_manual_wrap.jl)

Don’t have time at the moment, but I’d like to come back to implementing this if we end up fully adopting Julia into the project I am currently working on.
