OpenCV on Yocto Linux - opencv

How do I install openCV on Yocto Project? I am trying to use Intel Atom Board for Image Processing Project. What's the alternative if openCV is not compatible, openCL? Please help!

Just add opencv in your image recipe or in your local.conf
`IMAGE_INSTALL += "opencv"`

openCV creates dynamic package names for each library so unfortunately
CORE_IMAGE_EXTRA_INSTALL += "opencv"
will not install any libraries. Instead install specific libraries, example below. Note that you still need to install opencv in case you build an SDK
CORE_IMAGE_EXTRA_INSTALL += "opencv libopencv-core libopencv-imgproc"

Related

How to manage cross-platform binary package with conan?

I'm trying to develop a conan package for OpenCV pre-built binaries according to our specs. I need these to be available for Windows and Linux but am at a loss on best practices to structure the conan file.
How should I package both binaries? Should I instead create a package for each OS?
Packing OpenCV is not an easy task, there is an official recipe available and provided by Conan Community here
To install OpenCV:
conan install -r conan-center opencv/4.1.0#conan/stable
There are more versions available, you can list those version by:
conan search -r conan-center opencv
Also, there is a good blog post about OpenCV + Conan here
How should I package both binaries? Should I instead create a package for each OS?
Each recipe should be able to distribute the same project for ANY platform. You can create multiple methods, one per OS. For example, some projects are distributed with CMake and autotools, where CMake only works on Windows. Take a look in OpenCV Conan recipe, you can learn a lot.
If you are interested in packages where you need to download an installer, so mingw Conan recipe is a good example.
Regards!

Compiling Darknet with opencv-python

I installed Darknet with CUDA support. I ran
./darknet detector test cfg/coco.data cfg/yolov3.cfg yolov3.weights data/dog.jpg
I want it to run with opencv support. I had already installed opencv.
I compiled darknet with remake/make after making OPENCV=1 in Makefile, but still it is not detecting the installed opencv.
How can I make it to detect the already installed opencv?
I have installed opencv with this command pip install opencv-python --user before installing darknet.
You need to install the c++ libraries not just the python wrapper. You can do it from the sources: https://docs.opencv.org/trunk/d7/d9f/tutorial_linux_install.html.
In order to compile Darknet you will need OpenCV works with C/C++ code, not python. To check whether you have installed OpenCV correctly and can be used in C program, run this command :
pkg-config --modversion opencv
If it doesn't show anything or shows wrong version, try to reinstall OpenCV OR it is possible that your machine doesn't locate opencv version correctly.
So add command to your ~/.bashrc for example :
vim ~/.bashrc
export PKG_CONFIG_PATH=/home/user/installation/OpenCV-3.4.0/lib/pkgconfig
source ~/.bashrc
Notes : Change the path according to your opencv installation directory that contains opencv.pc
If you're following this repo https://github.com/AlexeyAB/darknet for Windows/Linux you need to download openCV (both OpenCV 2.x.x and OpenCV <= 3.4.0 (3.4.1 and higher isn't supported)) and put in this path for
Windows: ( C:\opencv_3.0\opencv\build\include & C:\opencv_3.0\opencv\build\x64\vc14\lib)
More instructions in the repo. If you're on Windows/Linux and still trying to figure things out you may check a video I made on that topic https://youtu.be/-HtiYHpqnBs

How to build openCV 3.3.0 with GStreamer on Windows

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.

What do we need to install for developing with JavaCV?

I want to use and learn JavaCV.
• So, I read some articles about how to set up JavaCV development environment in Window 7. At first they download and install OpenCV and adding some directory paths to System Variable, After that ,they extract javacv-0.7-bin.zip and javacv-0.7-cppjars.zip packages to somewhere(probably C:) and add some .jar files to their projects.
My Question : Do I need to install OpenCV for developing in JavaCV? because I wrote some JavaCV programs and my JavaCV programs compile and run properly (without installing OpenCV).
According to a javacv developer, the answer is NO. It comes bundled. Source: javacv issue 406 on GitHub.

OpenCV as a static library (cmake options)

I want to use OpenCV library in an embedded system and I need to compile my project using OpenCV as a static library.
How can I create the library using cmake options ?
To build OpenCV as static library you need to set BUILD_SHARED_LIBS flag to false/off:
cmake -DBUILD_SHARED_LIBS=OFF ..
But I think it is not enough for your task because you actually need to cross-compile library for you architecture. In case of Android or IOS such port already exists and you can simply use it. In case of another platform you need to create your own cmake toolchain file for cross-compiling and probably make a number of fixes in OpenCV build system.
The BUILD_SHARED_LIBS=OFF cmake option will create static libraries.
It should be noted that at the time of writing this, OpenCV does not really support static build, in that the result will not be useable when installed somewhere.
https://github.com/opencv/opencv/issues/21447#issuecomment-1013088996

Resources