It looks like I was too quick with my findings... :-(

First of all - to make clear my previous post: I removed tesseract include
from ocrRead.cpp to ocrRead.h (see attached file) and I was able to compile
your test case. If I did not change your test case - it fails as you
described.

Next: I tried to dig in the problem and I found out problem is not in
opencv... There is easy fix - just do not use "using namespace std;"[1] or
use it after including tesseract header files...

[1]
http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice

Zdenko


On Mon, Mar 17, 2014 at 11:00 AM, Giseli Ramos <[email protected]>wrote:

> That is weird... well, I have tried to put the include before anything,
> not resolved the problem.
>
> I will try to compile the project without c++11 and see what happens.
>
>
> On Friday, March 14, 2014 6:58:57 PM UTC-3, zdenop wrote:
>
>> It looks like "#include <opencv2/core/core.hpp>" cause problem for
>> tesseract in case of c++11...
>>
>> As quick fix it looks like putting "#include <tesseract/baseapi.h>" above
>> that line should be sufficient.
>>
>> Maybe somebody with more time/experiences in c++11 should do deeper
>> investigation of this.
>>
>> Zdenko
>>
>>
>> On Fri, Mar 14, 2014 at 7:11 PM, Giseli Ramos <[email protected]>wrote:
>>
>>> I'm sending a test case that reproduce the problem.
>>>
>>>
>>> On Friday, March 14, 2014 2:43:42 PM UTC-3, Giseli Ramos wrote:
>>>>
>>>> Ok, I'm using Linux Mint 14 (cinnamon)
>>>> Tesseract from svn code revision 1054 (last fetched 13 Mar)
>>>> Leptonica 1.70
>>>> g++ 4.7.2
>>>> Qt 4.8.4 (Qt Creator 2.8.0)
>>>> Using OpenCV 2.4.8, c++11 and boost lib.
>>>>
>>>> At the moment, I can't paste the project here. Later, I will try to
>>>> create a simple test case, but I suspect that it will compile because is
>>>> simple...
>>>>
>>>> The redefinition problem with templates could be a problem with using
>>>> the boost and c++11?
>>>>
>>>> On Friday, March 14, 2014 9:31:19 AM UTC-3, zdenop wrote:
>>>>>
>>>>> You will need to provide more information (e.g. tesseract version,
>>>>> compiler and its version, basic OS info) and maybe full test case (you was
>>>>> able to install/compile tesseract on your system, so there must be problem
>>>>> in your project why you are not able to use tesseract library). If your
>>>>> project is online available, please send link to it.
>>>>>
>>>>> Zdenko
>>>>>
>>>>>
>>>>> On Fri, Mar 14, 2014 at 12:22 PM, Giseli Ramos <[email protected]>wrote:
>>>>>
>>>>>> I'm trying to compile my project in Qt that uses tesseract and
>>>>>> opencv. In the .pro file:
>>>>>>
>>>>>> INCLUDEPATH += /usr/local/include/tesseract
>>>>>>
>>>>>> INCLUDEPATH += /usr/local/include/leptonica
>>>>>>
>>>>>> LIBS += -ltesseract -llept
>>>>>>
>>>>>>
>>>>>> The errors (I only past the first lines, because is a big list, all
>>>>>> from tesscallback.h):
>>>>>>
>>>>>> In file included from /usr/local/include/tesseract/baseapi.h:31:0,
>>>>>>
>>>>>> from src/utils/ocrReader.cpp:6:
>>>>>>
>>>>>> /usr/local/include/tesseract/tesscallback.h:278:29: error:
>>>>>> 'remove_reference' is not a template
>>>>>>
>>>>>> /usr/local/include/tesseract/tesscallback.h:278:29: error:
>>>>>> redefinition of 'struct remove_reference<T>'
>>>>>>
>>>>>> /usr/local/include/tesseract/tesscallback.h:277:29: error: previous
>>>>>> definition of 'struct remove_reference<T>'
>>>>>>
>>>>>> /usr/local/include/tesseract/tesscallback.h:296:12: error: expected
>>>>>> nested-name-specifier before 'remove_reference'
>>>>>>
>>>>>> /usr/local/include/tesseract/tesscallback.h:296:12: error: expected
>>>>>> ';' at end of member declaration
>>>>>>
>>>>>> /usr/local/include/tesseract/tesscallback.h:296:28: error: expected
>>>>>> unqualified-id before '<' token
>>>>>>
>>>>>> What is strange is that I have compiled with sucess with another
>>>>>> simple qt project to test tesseract funcionality, with the same config in
>>>>>> the .pro file. I don't know why this project in particular is having
>>>>>> issues.
>>>>>>
>>>>>> --
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "tesseract-ocr" group.
>>>>>> To post to this group, send email to [email protected]
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected]
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/tesseract-ocr?hl=en
>>>>>>
>>>>>> ---
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "tesseract-ocr" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>  --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "tesseract-ocr" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/tesseract-ocr?hl=en
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "tesseract-ocr" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> --
> You received this message because you are subscribed to the Google
> Groups "tesseract-ocr" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/tesseract-ocr?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "tesseract-ocr" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
#ifndef OCRREADER_H
#define OCRREADER_H

// Tesseract
#include <tesseract/baseapi.h>

// OpenCV
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
// C++
#include <iostream>
// Boost
#include <boost/filesystem.hpp>

using namespace cv;
using namespace std;

class ocrReader
{
public:
    ocrReader();
    void scanDetectionsFindWeight(const Mat &img, std::vector<std::map<double, Rect> > &resultsFinal);
    string detectWeight(Mat &img, const int &kLocation);
};

#endif // OCRREADER_H

Reply via email to