Open skitscha opened 5 years ago
Hi! I can look into building it with never versions of OpenCV and Ubuntu. The downgrading of gcc requirement was related to naoqi SDK, I am sure it was necessary at some point, but did not try with never versions of naoqi SDK. Which version of NAO do you have?
Hi @skitscha ,
It's me again. I managed to build it on Ubuntu 18.04 without building opencv2.4.9, will test later today if it runs. There are some hacks needed, but it shouldn't be too difficult if it runs.
Thanks for your help. I believe I have one of the earlier versions of nao and I'm stuck on the 2.1.4 version of the SDK.
Hi, I've got some bad news. And some good news too.
Unfortunately, it seems that you still need to downgrade gcc and g++ to 4.8. I suggest using update-alternatives so you can set it up alongside the existing gcc versions Ubuntu uses. Just install gcc and g++ 4.8 using apt and then follow these instructions to set up update-alternatives. Then you can have the default gcc and switch to 4.8 when needed.
Unfortunately number 2, you still have to build your own version of OpenCV to fix the broken SDK, since it relies on some system libraries that are not available on 18.04 (libpng12 to be exact, maybe some others). These are the steps I did to build OpenCV 2.4 on Ubuntu 18.04 using gcc4.8 and g++4.8 (in some empty folder on your system):
git clone git@github.com:opencv/opencv.git
cd opencv
git checkout 2.4.9
mkdir build
mkdir install
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=<path to your folder>/opencv/install -D WITH_FFMPEG=OFF ..
make -j4
make install
This will put all libraries in the install folder inside the opencv folder. Now just open the naoqi SDK lib folder and opencv/install folder and replace every libopencv* in the SDK.
Unfortunately number 3, this will fix the OpenCV issues, you can try to build nao-ocr but it will probably fail because libpng will complain about missing some function from the zlib library. This happens because Ubuntu 18.04 uses libpng16 while older Ubuntu versions used libpng12 and now libpng needs newer version of zlib which naoqi SDK does not provide. I did the following (in some workspace folder, wherever you like to build stuff):
wget http://www.zlib.net/zlib-1.2.11.tar.gz
tar -xvzf zlib-1.2.11.tar.gz
cd zlib-1.2.11/
mkdir install
./configure --prefix=<some path to your working folder>/zlib-1.2.11/install/
make
sudo make install
This will put built files into your install folder, go inside and copy libz.so
, libz.so.1
and libz.so.1.2.11
to the lib folder of the naoqi SDK.
Finally some good news, now you can try to build nao-ocr and you should be able to.
When running, if you get error messages from tesseract, you probably don't have language data which you can fix by installing them:
sudo apt install tesseract-ocr-eng
(for english language, ofc)
To run stuff, you will need working connection to the robot. Go to the ./OcrModule --pip nao.local --pport 9559
You should get a message like this at the end:
[I] 31014 core.common.toolsmain: OcrModule is ready... Press CTRL^C to quit
This means that the module is running and waits for the command to start recognizing stuff. Copy the nao.config file to the bin terminal and update the IP, check readme for other parameters. In other terminal, from the same /sdk/bin folder run:
./naoocr
The shell will printout the result. If you put OUTPUT_MODE to SPEAK, NAO will say the text from the result.
However, I do not have a clean Ubuntu 18.04 setup, so please let me know if stuff breaks on your end. If you manage to install everything, I will update README with this new information.
I think that worked for the most part. But, now Im getting the following error when I try to configure the project. Have you ever seen this before By not providing "FindALVISION.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "ALVISION", but CMake did not find one.
Could not find a package configuration file provided by "ALVISION" with any of the following names:
ALVISIONConfig.cmake
alvision-config.cmake
Just to make sure, you are using qibuild for building?
Yes I am. I'm running this command. qibuild configure TessTextRec I have followed the steps to fix the opencv files and have the files from github copied into the naosdk c++ folder.
did you set up the toolchain and config like this: http://doc.aldebaran.com/qibuild/beginner/qibuild/aldebaran.html
it should not happen if everything is set up correctly
That fixed the issue and I was able to configure the project. But, when I build it now I'm getting a ton of errors. Did I do something else wrong?
/home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/APIwrappers.h:41: undefined reference to AL::ALValue::ALValue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' CMakeFiles/OcrModule.dir/OcrModule.cpp.o: In function
ALtoSTRINGabi:cxx11':
/home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/APIwrappers.h:69: undefined reference to AL::ALValue::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&[abi:cxx11]()' CMakeFiles/OcrModule.dir/OcrModule.cpp.o: In function
OcrModule::OcrModule(boost::shared_ptrAL::ALModule::ALModule(boost::shared_ptr<AL::ALBroker>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/OcrModule.cpp:26: undefined reference to
AL::ALModuleCore::setModuleDescription(std::cxx11::basic_string<char, std::char_traitsAL::ALModuleCore::getName[abi:cxx11]() const' /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/OcrModule.cpp:28: undefined reference to
AL::ALModuleCore::functionName(std::AL::ALModuleCore::addParam(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/OcrModule.cpp:30: undefined reference to
AL::ALModuleCore::addParam(std::cxx11::basic_string<char, std::char_traitsAL::ALModuleCore::getName[abi:cxx11]() const' /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/OcrModule.cpp:33: undefined reference to
AL::ALModuleCore::functionName(std::cxx11::basic_string<char, std::char_traitsAL::ALModuleCore::getName[abi:cxx11]() const' /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/OcrModule.cpp:38: undefined reference to
AL::ALModuleCore::functionName(std::AL::ALModuleCore::getName[abi:cxx11]() const' /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/OcrModule.cpp:41: undefined reference to
AL::ALModuleCore::functionName(std::cxx11::basic_string<char, std::char_traitsAL::ALModuleCore::getName[abi:cxx11]() const' /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/OcrModule.cpp:44: undefined reference to
AL::ALModuleCore::functionName(std::AL::ALModuleCore::setReturn(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/OcrModule.cpp:48: undefined reference to
AL::ALModuleCore::getName[abi:cxx11]() const'
/home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/OcrModule.cpp:48: undefined reference to AL::ALModuleCore::functionName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)' /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/OcrModule.cpp:49: undefined reference to
AL::ALModuleCore::setReturn(std::cxx11::basic_string<char, std::char_traitsAL::ALModuleCore::getName[abi:cxx11]() const' /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/OcrModule.cpp:52: undefined reference to
AL::ALModuleCore::functionName(std::cxx11::basic_string<char, std::char_traitsqi::log::LogStream::~LogStream()': /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/include/qi/details/log.hxx:261: undefined reference to
qi::log::log(qi::LogLevel, qi::log::detail::Category*, std::qi::TypeImpl<qi::MetaSignal>::set(void**, std::vector<void*, std::allocator<void*> > const&)': /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/include/qitype/metasignal.hpp:45: undefined reference to
qi::MetaSignal::MetaSignal(unsigned int, std::cxx11::basic_string<char, std::char_traitsqi::TypeImpl<qi::MetaSignal>::className[abi:cxx11]()': /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/include/qitype/metasignal.hpp:45: undefined reference to
qi::detail::normalizeClassName(std::qi::TypeImpl<qi::MetaProperty>::set(void**, std::vector<void*, std::allocator<void*> > const&)': /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/include/qitype/metaproperty.hpp:42: undefined reference to
qi::MetaProperty::MetaProperty(unsigned int, std::cxx11::basic_string<char, std::char_traitsqi::TypeImpl<qi::MetaProperty>::className[abi:cxx11]()': /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/include/qitype/metaproperty.hpp:42: undefined reference to
qi::detail::normalizeClassName(std::qi::TypeImpl<qi::MinMaxSum>::className[abi:cxx11]()': /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/include/qitype/details/anyobject.hxx:1041: undefined reference to
qi::detail::normalizeClassName(std::cxx11::basic_string<char, std::char_traitsqi::TypeImpl<qi::MethodStatistics>::className[abi:cxx11]()': /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/include/qitype/details/anyobject.hxx:1046: undefined reference to
qi::detail::normalizeClassName(std::qi::TypeImpl<qi::EventTrace>::className[abi:cxx11]()': /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/include/qitype/details/anyobject.hxx:1052: undefined reference to
qi::detail::normalizeClassName(std::cxx11::basic_string<char, std::char_traitsqi::TypeImpl<qi::os::timeval>::className[abi:cxx11]()': /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/include/qitype/details/anyobject.hxx:1063: undefined reference to
qi::detail::normalizeClassName(std::AL::ALModuleCore::execute(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, AL::ALValue const&, AL::ALValue&)' CMakeFiles/OcrModule.dir/OcrModule.cpp.o:(.data.rel.ro._ZTV9OcrModule[_ZTV9OcrModule]+0x60): undefined reference to
AL::ALModuleCore::version[abi:cxx11]()'
CMakeFiles/OcrModule.dir/OcrModule.cpp.o:(.data.rel.ro._ZTV9OcrModule[_ZTV9OcrModule]+0x70): undefined reference to AL::ALModule::httpGet[abi:cxx11]()' CMakeFiles/OcrModule.dir/main.cpp.o: In function
main':
/home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/main.cpp:56: undefined reference to `ALTools::mainFunction(std::__cxx11::basic_string<char, std::char_traits
that looks like you are trying to build it with something other than gcc-4.8 and g++-4.8 combination. EDIT: try qibuild clean or deleting the build folder after switching between compilers and linkers, it failed for me without complete clean after switching to 4.8
I switchted to using gcc and g++ 4.8 However, I get the follwoing error now:
CMakeFiles/OcrModule.dir/picSceneDetect.cpp.o: In function picSceneDetection::runSceneDetection()': /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/picSceneDetect.cpp:98: undefined reference to
cv::imwrite(std::string const&, cv::_InputArray const&, std::vector<int, std::allocatorpicProcessing::runPicProcessing()': /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/picProcessing.cpp:98: undefined reference to
cv::imwrite(std::string const&, cv::_InputArray const&, std::vector<int, std::allocatorcv::imwrite(std::string const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)' CMakeFiles/OcrModule.dir/picSegmentation.cpp.o: In function
picSegmentation::runPicSegmentation()':
/home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/picSegmentation.cpp:202: undefined reference to cv::imwrite(std::string const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)' /home/steven/Documents/naoqi-sdk-2.1.4.13-linux64/picSegmentation.cpp:203: undefined reference to
cv::imwrite(std::string const&, cv::_InputArray const&, std::vector<int, std::allocator
The only way I could reproduce such error is to omit OPENCV2_HIGHGUI from qi_use_lib command for OcrModule (line 25 in CMakeLists.txt). If this is the case on your end, the errors are expected since highgui module deals with image loading and writing in OpenCV2. However, in OpenCV3, those functions are exported by imgcodecs module of OpenCV, so you are either missing OPENCV2_HIGHGUI as a reference in the qi_use_lib command, or you are missing 2 after OPENCV or you somehow built OpenCV3 as OpenCV2 and those functions are no longer in highgui module. Let me know if any of the above helps. Just make sure you built OpenCV 2.4.9 and replaced all opencv libraries in the toolchain folder with newly build ones.
I guess I might of copied the files over wrong. But what folder do you mean by the toolchain folder. Do you mean to copy all of the lib files from the opencv/build/lib to the lib folder in the naosdk folder? This is the folder structure of my naosdk folder. I've looked around in this folder and I don't see anywhere else where these opencv files go.
yes, you should copy newly built individual lib files from your opencv/build/lib folder to naoqi-sdk-2.1.4.13-linux64/lib (i don't think there is any harm in copying all of them).
That's what I did and I still got that error. I'm not sure what I'm doing wrong but I'll try to rebuild OpenCV and try again.
I tried to rebuild opencv and I still get the same error. I know i have the OPENCV2_HIGHGUI lib files in the naoqi-sdk-2.1.4.13-linux64/lib. I copied all of them over when I built opencv. The only other thing I could think of is that Im only building opencv 2 and not opencv 2 extra modules. I followed the tutorial in the read.me. But, This is no opencv 2 extra modules as far as I could find. The command that I'm using to build opencv 2 is: cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D INSTALL_C_EXAMPLES=OFF \ -D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python \ -D BUILD_EXAMPLES=ON Is there an opencv extra module 2 that I have to build. I'm using gcc and g++ 4.8 to build opencv and this project.
Hi again, sorry for being so late, I was doing some cleaning up and found that I did not respond to your last comment. I just noticed that you wrote you copied all OPENCV2_HIGHGUI libs, does that mean you only copied HIGHGUI lib or you just mistyped the comment? You should copy all opencv libraries into the toolchain (not all of them are necessary I think, but there is no harm in doing it). If you copied everything and still could not build nao-ocr, I can package my working toolchain, but I am not sure Softbank would allow sending it publicly.
Hello! For a project at my school I would like to re-use and build upon the work you have done already regarding Tesseract and NAO. However, I've been unable to compile opencv 2.4.9 on Ubuntu 18.0.4. It seems like there is an error compiling their version of opencv that you cannot work around. I am using gcc 4.8 but I'm not sure how to fix this issue. Do you know if it is possible to use a new version of opencv with this project?