Ask Your Question
0

Problem using CLAHE opencv c++

asked 2013-10-29 04:28:15 -0600

lo gravatar image

updated 2013-10-29 04:54:07 -0600

berak gravatar image

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!!

edit retag flag offensive close merge delete

Comments

could you add the exact error you get ?

berak gravatar imageberak ( 2013-10-29 04:55:53 -0600 )edit

oh, opencv version ? (it's not in 242, so you'll need something more recent)

berak gravatar imageberak ( 2013-10-29 05:02:20 -0600 )edit

And the opencv version is 2.4.6.0

lo gravatar imagelo ( 2013-10-29 05:26:19 -0600 )edit

hey, so ? i'm still puzzled.

berak gravatar imageberak ( 2013-10-29 05:53:49 -0600 )edit

Ok, sorry, I am having problems with the editor, I will try it again with the errors (one by one):

lo gravatar imagelo ( 2013-10-29 06:03:00 -0600 )edit

clahe.cpp:11:11: error: ‘cv::CLAHE’ has not been declared

using cv::CLAHE;

lo gravatar imagelo ( 2013-10-29 06:03:28 -0600 )edit

clahe.cpp: In function ‘int main(int, char**)’:

clahe.cpp:19:5: error: ‘CLAHE’ was not declared in this scope

Ptr<CLAHE> clahe = createCLAHE();

lo gravatar imagelo ( 2013-10-29 06:04:05 -0600 )edit

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...

lo gravatar imagelo ( 2013-10-29 06:39:32 -0600 )edit

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

Stannis gravatar imageStannis ( 2014-03-06 06:39:17 -0600 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2013-11-07 06:19:40 -0600

lo gravatar image

I got it. Finally it was a problem with the OpenCV compilation. My libraries were not properly located. I just did the compilation process again and now it works.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-10-29 04:28:15 -0600

Seen: 8,741 times

Last updated: Nov 07 '13