Compiling OpenCV-contrib for IOS (especially the SFM-Module) - ios

I've tried to install openCV_contrib for IOS, therefore I execute
python opencv/platforms/ios/build_framework.py "framework_dest"
on my Mac (I need Xcode for compiling openCV for IOS) but all the times, i got the message:
-- Checking SFM deps... FALSE
-- Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags
I need the SFM module, hence I tried installing Glog and Gflags at several ways: using
brew install glog gflags
and brew outputs, that those packages are successfully installed respective already installed.
Later I tried to compile both from GitHub on my own, but with no success, I'm still not able to compile SFM for IOS.
On Linux I could compile openCV including the SFM module, but I can't compile it for IOS, because Xcode is not available for Linux.
I don't know, what to do! Do some of you know how to install glog/gflags on Mac or do you know how to build the IOS-Framework of OpenCV on Linux or maybe how to build the IOS-Framework on my Mac using the binaries created with cmake .. && make in my Linux (because there SFM is compiled)?
There have to be some solution, because Mac is based on Linux, so if it works on Linux, why doesn't it work on my Mac?!
Thanks!

Related

Boost not found when installing dlib, but its actually installed

Im trying to install dlib for few cv2 projects, but I have problems installing it.I made everything without problem but when I wanted to finally do the python setup.py install It showed me this error message: Could NOT find Boost (missing: python) (found suitable version "1.79.0", minimum required is "1.41.0")
I mean why doesnt it work when it sees my installed Boost 1.79...
Does somebody know how to fix it guys?
Thank you anyways:)
From error log it looks like boost libraries are found, but it's missing specific boost library to integrate with python
You have not mentioned which OS you are using for debian & it's derivatives
sudo apt-get install libboost-python-dev or if you are installing specific version of boost sudo apt-get install libboost-python1.79-dev should install the python module.
If boost is built from sources, during bootstrapping enable python libs to be built
./bootstrap.sh --with-libraries=python,filesystem,serialization
for list of boost libs can be built
./bootstrap.sh --show-libraries

CMake fails to find OpenCV installed via vcpkg under wsl (returns opencv for Windows Conda Environment)

So I am currently trying to get my CMake Project to build after installing packages via vcpkg for the first time.
I am using WSL2 under Win10 with Ubuntu 20.04 for the project, but building throws the following:
philip#DESKTOP-2CHKCMO:/mnt/c/Users/phili/_Documents/Projects/pixelator$ cmake .
-- OpenCV ARCH:
-- OpenCV RUNTIME:
-- OpenCV STATIC: ON
CMake Warning at /mnt/c/Users/phili/anaconda3/Library/opencvConfig.cmake:140 (message):
Found OpenCV Windows Pack but it has no binaries compatible with your
configuration.
You should manually point CMake variable OpenCV_DIR to your build of OpenCV
library.
Call Stack (most recent call first):
CMakeLists.txt:13 (find_package)
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/c/Users/phili/_Documents/Projects/pixelator
This is my CMakeLists.txt:
cmake_minimum_required(VERSION 3.16)
project(pixelator LANGUAGES CXX)
#include("~/vcpkg/scripts/buildsystems/vcpkg.cmake")
set(CMAKE_TOOLCHAIN_FILE "~/vcpkg/scripts/buildsystems/vcpkg.cmake")
set(OpenCV_DIR "~/vcpkg/packages/opencv4_x64-linux/share/opencv")
find_package(protobuf CONFIG REQUIRED)
find_package(opencv CONFIG REQUIRED)
find_package(gflags CONFIG REQUIRED)
add_library(pixeling ${CMAKE_SOURCE_DIR}/source/pixeling.cpp)
target_link_libraries(pixeling ${OpenCV_LIBS})
add_executable(io ${CMAKE_SOURCE_DIR}/source/io.cpp)
target_link_libraries(io pixeling gflags)
The Folder is located in Windows10, but I am building via Ubuntu.
Apparently CMake seems to ignore that I set the OpenCV_DIR and returns an openCV installation for my python anaconda environment (which is not located in wsl, but Windows), which it can't use. Also, I was under the impression that I would not even be required to set the OpenCV_DIR after linking the Toolchain file?
How do I get it to find the right openCV installation?

building opencv with sfm module issues

I am trying to build opencv with sfm modules I've built and installed gflags then glog and the ceres-solver. Yet the make logs says: Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags. Even though in earlier lines it says it finds both to these directories.
I've also built and installed VTK though for some reason it doesn't find it even when I manually select the build directory.
Below is the relevant section of my CMake log:
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
OpenCV Python: during development append to PYTHONPATH: C:/DEV/opencv-4.2.0/builds/python_loader
Caffe: NO
Protobuf: NO
Glog: YES
freetype2: NO
harfbuzz: NO
Module opencv_ovis disabled because OGRE3D was not found
No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
Found installed version of gflags: C:/Program Files (x86)/gflags/lib/cmake/gflags
Detected gflags version: 2.2.2
Checking SFM deps... FALSE
Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags
I managed to get the SFM module to compile finally. I am not 100% on what fixed it but here is what I did: I deleted all versions of gflags, glog, and ceres-solver. I downloaded a slightly older version of ceres-solver (1.14) and VTK (8.2.0). The earlier versions might be related to using opencv4.2 and python 3.7.
I placed gflags and glog in the ceres-solver folder with eigen. Then using CMake and visual studio 2019 I built and installed gflags in debug and release. glog (linking to gflags) only in release. Finally, I built and installed ceres-solver linking to glog, gflags and eigen. Following this tutorial: http://sylvain.duchene.im/how-to-build-ceres-under-windows/
Then when I used CMake to build openCV4.2 with the contribs libraries I found both the sfm module and VTK.

What is the proper way of adding a local dependency (openCV) in Meson?

I am using OpenCV in one of my projects. Until now, I was using version 3 under Ubuntu 18.04, so in my meson.build I had:
... dependencies: [dependency('opencv')])
Now, I've compiled OpenCV 4 from source and installed to the default dir, /usr/local/, and changed my meson.build to:
... dependencies: [dependency('opencv4')])
Resulting in a not found error (despite this works with Ubuntu 20.04 and the package from the official repos, which is version 4.2). How should I specify the library's location so Meson can find it?
I've seen find_library, but that's deprecated according the docs.
The dependency function is using pkg-config or cmake if pkg-config fails, to find external dependency (installed library).
When you install OpenCV4, please check if there is pkg-config for opencv4. Here is my command:
pkg-config --list-all | grep "opencv4"
and output:
opencv4 OpenCV - Open Source Computer Vision Library
Also, check PKG_CONFIG_PATH environment variable. pkg-config will use that path to search for .pc files.
Edit:
be sure to use -D OPENCV_GENERATE_PKGCONFIG=YES when building opencv with cmake.

OpenCV Crosscompile for ARM: highgui error (GTK2+)

I'm have build the OpenCV library from source for Zynq (ARM). But, OpenCV was build on the same PC for x86 (PC) also. Firstly, I can execute every example on my PC without any issues. Secondly, I am able to crosscompile and execute every program on the arm target, except the ones including highgui libraries, where I receive the following error:
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvShowImage, file /home/hristov/workspace/opencv/modules/highgui/src/window.cpp, line 534
terminate called after throwing an instance of 'cv::Exception'
what(): /home/user/workspace/opencv/modules/highgui/src/window.cpp:534: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvShowImage
Yes, I have gone through the forum for solutions for this issue but some answers were unclear and I would like some more detail into this. I have created the OpenCV build for ARM build WITH_GTK and GTK2. Also installed libgtk2.0-dev, pkg-config
However, From another topic on this forum, I learned that the problem lies in setting up the pkg-config: http://answers.opencv.org/question/57945/opencv-gui-with-gtk-2-solved/
Q) Based on the above solution, Do you set the path for PKG_CONFIG_PATH on your ARM platform (Zynq) or on the PC platform (Ubuntu PC)? Because, it is already set to the described path on the ARM platform whereas it is different on the PC Linux platform. More details of the current path is shown below:
PKG_CONFIG_PATH in PC(Ubuntu):
/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
PKG_CONFIG_PATH in ARM (Embedded platform):
/usr/local/lib/arm-linux-gnueabihf/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
If the pkg-config must be changed on my PC, to the /usr/lib/arm-linux-gnueabihf/pkgconfig/ location, I cannot find any pkg-config in that location. Should I create a new one, by copying the folder from my target?
Q) Also, Should the GTK libraries also be installed in the Target Embedded system (ARM)?
Hope someone can help me with this solution as I have rebuild the libraries umpteen times with many different solutions, but to no avail. Thanks!

Resources