I have OpenCV 3.4 installed in Ubuntu 18. I also have installed ROS Melodic according to the website instructions. However, I keep on getting an error that libopencv_core.so.3.2 is required.
I already set my CMakeLists files to point to OpenCV 3.4.
However, I found out that in the file:
/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake
there is the following line hardcoded in opencv3.2:
set(libraries "cv_bridge;/usr/lib/x86_64-linux-gnu/libopencv_core.so.3.2.0;/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.3.2.0;/usr/lib/x86_64-linux-gnu/libopencv_imgcodecs.so.3.2.0").
I tried to change it to 3.4 but I can not rebuild it.
The error I am getting is:
/opt/ros/melodic/lib/image_view/image_view: error while loading shared libraries: libopencv_core.so.3.2: cannot open shared object file: No such file or directory
Why is OpenCV 3.2 hardcoded in cv_bridge and how can I rebuild it with OpenCV 3.4?
Update:
I eventually installed OpenCV 3.2 and it worked properly.
Because opencv development speed is much faster than ROS individual module. And a lot of ROS modules went depreciated after someone left the job.
But that's by no means the end of the day( maybe end of the day for noobs). You can build it directly with any version of opencv core function(besides imshow kind of function) others should perform just fine.
The easiest way is to do is: in the console before executing catkin_make try to execute the following
export CMAKE_PREFIX_PATH=/usr/local:$CMAKE_PREFIX_PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
This should give preference to your custom OpenCV installation when doing the find_package(OpenCV 3.X.0 REQUIRED). Then compile and use the function of that version.
Well if you do have to use 3.4 then I think you have to build ros version of opencv and image transport and cvbridge to the 3.4 if that's what you are targeting.
You can find the link here https://github.com/ros-gbp/opencv3-release The highest they provide seems to be 3.3
Related
Having Gstreamer 1.22 successfully installed I'm not able to configure the project to build OpenCV. CMake isn't able to find GStreamer on my machine. Any ideas how two address this issue?
Just found the solution:
Cmake is using FindGstreamerWindows.cmake to find GStreamer on Windows, which is using internal an environment variable called "GSTREAMER_DIR" pointing to ..\gstreamer\1.0\x86_64.
Please make sure GSTREAMER_DIR exists on your machine.
I recently compile Opencv 4.2 with GStreamer on Windows. I use settings for GStreamer as on the following pictures. Make sure you point to correct .lib and include directories. all_Library is gstapp-1.0.lib etc, when configuraing CMAKE to compile OpenCV.
I use Opencv 4.2, CMake 3.17.0 release candidate and Gstreamer 1.16.2 MSVC 64-bit (VS 2019) developer and runtime installer. The whole process is described here install OpenCV on windows GStreamer tutorial
The important part is to set up environmental variables to find Gstreamer Runtime. Into system variable path: add
xxx\1.0\x86_64\bin
xxx\1.0\x86_64\lib
xxx\1.0\x86_64\lib\gstreamer-1.0
Gstreamer pipe from c++ opencv program to the web.
I am trying to install the Projector-Camera Calibration software available on: http://mesh.brown.edu/calibration/ . The software demands having installed Qt 4.8.4 and OpenCV 2.4.3 on my computer. It cannot work (as far as i know according to my research and INSTALL.txt file in the installation package) with any other versions of Qt and OpenCV. My problem is that OpenCV 2.4.3 version is no longer available anywhere on the Internet to download. It is not even available on the official OpenCV website: http://opencv.org/releases.html . I've tried downloading other versions of OpenCV, but none of them seems to work with this calibration software. More specifically, when I try to execute nmake release command in my Developer Command Prompt for VS 2017, the
LINK : fatal error LNK1181: cannot open input file
'opencv_core243.lib'
message is displayed which is expected because other versions of OpenCV do not have opencv_core243.lib file. I've done everything demanded in INSTALL.txt file, the PATH variable is set properly and everything else.
Can anybody help me with this problem or send me a link for downloading the OpenCV 2.4.3 if it is available somewhere on the Internet?
I don't see why the library should be dependent on that version of OpenCV. From my experience, the camera calibration functions are very stable through different versions.
You should be able to build the library with other versions of OpenCV by editing the file projector-calib.pro from:
# Windows 7
win32:OPENCV_DIR = "C:/opencv/opencv-2.4.3/opencv/build"
win32:OPENCV_LIB_DIR = $$OPENCV_DIR/x86/vc10/lib
win32:CV_VER = 243
to:
# Windows 7
win32:OPENCV_DIR = "C:/{YOUR_PATH}/opencv/build"
win32:OPENCV_LIB_DIR = $$OPENCV_DIR/{x64/x86}/vc12/lib
win32:CV_VER = {VERSION}
and substituting {YOUR_PATH}, {X64/X86} and {VERSION} properly. For OpenCV 2.4.13, for example, {VERSION} is 2413.
all!
I am trying to use OpenCV library in CLion project, but this is unsuccessful. I have opencv 3.2.0 installed with ROS kinetic at once (I can see it in /opt/ros/kinetic/include/opencv-3.2.0 directory and I can import cv2 by python). But when I use such CMakeLists.txt:
cmake_minimum_required(VERSION 3.6)
project(visual_slam)
set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILES main.cpp)
set(OpenCV_DIR /opt/ros/kinetic/include/opencv-3.2.0)
include_directories( ${OpenCV_DIR})
add_executable(visual_slam ${SOURCE_FILES})
with the next simple code:
#include <iostream>
#include <opencv2/opencv.hpp>
using namespace cv;
int main()
{
return 0;
}
I get the next error:
CMakeFiles/visual_slam.dir/main.cpp.o: In function cv::String::~String()':
/opt/ros/kinetic/include/opencv-3.2.0/opencv2/core/cvstd.hpp:664: undefined reference tocv::String::deallocate()'
CMakeFiles/visual_slam.dir/main.cpp.o: In function cv::String::operator=(cv::String const&)':
/opt/ros/kinetic/include/opencv-3.2.0/opencv2/core/cvstd.hpp:672: undefined reference tocv::String::deallocate()'
Such error was discussed also in OpenCV linking problems with ROS, but is it really so necessary to uninstall completely and then install again OpenCV? Is there any more quick solution?
Second question, how to correctly add OpenCV from ROS to CMakeLists.txt? Current CMakeLists (look above) does not look like to be flexible. I've already tried to add
find_package(OpenCV 3 REQUIRED)
target_link_libraries(visual_slam ${OpenCV_LIBRARIES} )
but the error is when CMake builds
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.
Could not find a package configuration file provided
by "OpenCV" (requested version 3) with any of the following names:
OpenCVConfig.cmake
opencv-config.cmake
The second error you are getting (namely the missing OpenCV.cmake) is actually not only related to the first one (the undefined reference to) but is the cause.
If cmake fails to find the OpenCV module the ${OpenCV_LIBS} won't do a thing meaning that target_link_libraries(visual_slam ${OpenCV_LIBRARIES} ) doesn't link against the libraries your code requires. That said I also believe that it's OpenCV_LIBS instead of OpenCV_LIBRARIES.
You can of course specify the path where the find_package(...) command looks at to find cmake modules (I think it was the CMAKE_FIND_ROOT_PATH variable) or even manually specify the root folder of your OpenCV installation and manually handle all the things that the OpenCV.cmake handles for you.
Last but not least I'm not sure if ROS Kinetic uses the latest OpenCV (what you are using namely the v3.2). You should check that and if different versions are used (very likely), you will have to build all ROS OpenCV-related packages from scratch. You might ask "Why should I do that?". Well, to avoid compatibility issues and various weird errors that may or may not occur (depending on what OpenCV functionality you use) due to version X of OpenCV being used for the binary packages of ROS and version Y present on your system (with X != Y). I had to do that with PCL (Point Cloud Library) once and it took me several days to come to this conclusion since the errors that I was getting were (typical for C++) cryptic as hell. To avoid conflicts make sure that only the one version of OpenCV is present on your system (that is can be found by cmake) that you want to use with your ROS installation. That's also the reason why the ROS binary packages are shipped through the Ubuntu repos using dependencies that are resolved by the package manager (OpenCV, PCL etc.).
PS: Since I haven't used Clion I would also suggest (before doing anything I've mentioned above) to check if it's not some hidden cmake-related setting inside the IDE that screws things up.
I have started to work on Rpi. I have worked on opencv on windows and ubuntu. Now I want to do Image porcessing on Rpi. I have installed latest version 2.4.8 on my Rpi. And I am able to open and display an image. However when I am trying to open webcam and display, it gives me error: HIGHGUI ERROR: v4l/v4l2: VIDIOC_CROPCAP.
Can anyone tell whats the problem ?
I haved the some error when trying to execute a code that does facedetection , i solved it by adding the files needed in my working folder (source folder).
you can show us the code to find out what exactly you need
If you are using prebuilt binaries, they may be built without v4l support. Try to build your own OpenCV with v4l checked. And of course before that install v4l with development files. You can follow this tutorial with how to install required dependicies explanied.
I was installing QT5 and OpenCV 2.4.4 with CMAKE 2.8.10.2..
I was following the instruction from here and here .
The problem is, when I want to compile the OpenCV library with cmd, 'mingw32-make' is not recognized as internal or external command, operable program or batch file.
I don't know how to react, I've follow the instruction step by step..
Thanks for your answers :)
===============================
This question has been answered :)
the answer is I didn't put the path contains mingw32-make.exe (Qt5.0.2\Tools\MinGW\bin) to system variable. different version different path, made me confuse.
So, if you want to integrate Qt 5.0.2 and OpenCV 2.4.4 with CMAKE 2.8.10.2 in Windows 7, use instructions from two links that I mention it above, it works! Thanks:)
In start menu you can find pre-configured environment variable command prompt link for Qt MinGW. If you are using Qt 5.0.2 for Windows 32-bit (MinGW 4.7, 650 MB) you may find something like Qt 5.0.2 for Desktop (MinGW 4.7). Use it for your command. Please make sure you are using mingw32 version of Qt otherwise the command you are looking for is nmake.