Problem using CLAHE opencv c++
Hi there!
I am using Opencv for C++ to translate some algorithms from Matlab. I am trying to use gpu::CLAHE::apply because it seems to be so similar to "adapthisteq" in Matlab. The point is that I am not able to use it since the compilator does not recognize anything about CLAHE.
I am sure I am doing something wrong, but I have tried a thousand different ways and it does not work. My last attempt is this:
#include <opencv2/opencv.hpp>
#include "opencv2/imgproc/imgproc.hpp"
#include <string>
#include <iostream>
#include <cstdlib>
#include "cxcore.h"
using namespace cv;
using namespace std;
using cv::CLAHE;
int main( int argc, char** argv )
{
Mat m= imread("lena.png",CV_LOAD_IMAGE_GRAYSCALE); //input image
imshow("lena_GRAYSCALE",m);
Ptr<CLAHE> clahe = createCLAHE();
clahe->setClipLimit(4);
Mat dst;
clahe->apply(m,dst);
imshow("lena_CLAHE",dst);
waitKey();
}
Thank you very much in advance!!
could you add the exact error you get ?
oh, opencv version ? (it's not in 242, so you'll need something more recent)
And the opencv version is 2.4.6.0
hey, so ? i'm still puzzled.
Ok, sorry, I am having problems with the editor, I will try it again with the errors (one by one):
clahe.cpp:11:11: error: ‘cv::CLAHE’ has not been declared
using cv::CLAHE;
clahe.cpp: In function ‘int main(int, char**)’:
clahe.cpp:19:5: error: ‘CLAHE’ was not declared in this scope
Ptr<CLAHE> clahe = createCLAHE();
clahe.cpp:19:32: error: ‘createCLAHE’ was not declared in this scope
Ptr<CLAHE> clahe = createCLAHE();
clahe.cpp:20:6: error: base operand of ‘->’ is not a pointer
clahe->setClipLimit(4);
clahe.cpp:23:6: error: base operand of ‘->’ is not a pointer
clahe->apply(m,dst);
That's all, sorry for the inconvenience! The thing is that it does not understand CLAHE, but I do not know how to declare it in order to use the function gpu::CLAHE::apply...
I´m trying to do the same thing but in Emgu, which is OpenCV in C#. Could anybody post the exact same example????
Thank you very much