Perform histogram equalization of an image by using the prebuilt MATLAB interface to the OpenCV function cv::CLAHE
. The cv::CLAHE
function is a base class, and you must create a MATLAB interface object by using the getBasePtr
utility function to access the public methods and attributes of the base class.
Add the MATLAB interface to OpenCV package names to the import list.
Read an image into the MATLAB workspace.
Create the MATLAB interface objects for the OpenCV MatND
and InputArray
classes to store the input image.
Create the MATLAB interface objects for the OpenCV MatND
and OutputArray
classes to write the output image returned by the OpenCV function.
Create a MATLAB interface object to represent the smart pointer of the OpenCV CLAHE class cv::CLAHE
.
Create a MATLAB interface object for the base class cv::CLAHE
.
Set the value of clip limit to 4
.
Perform contrast-limited adaptive histogram equalization by using the apply
method of the cv::CLAHE
base class.
Read the enhanced output image.
Display the original input and the enhanced output image.