You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
By clicking “Sign up for GitHub”, you agree to our
terms of service
and
privacy statement
. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Using VSCode and dot net core 2.2 following the instructions 👍
dotnet new console -n ConsoleApp01
cd ConsoleApp01
dotnet add package OpenCvSharp4
dotnet add package OpenCvSharp4.runtime.ubuntu.18.04-x64
-- edit Program.cs ---
dotnet run
When I add the following code
using System;
using OpenCvSharp;
namespace ConsoleApp01
class Program
static void Main(string[] args)
var srcImage = new Mat(@"/somepathtoafile.jpg");
Cv2.ImShow("Source", srcImage);
Cv2.WaitKey(1); // do events
Environment
Ubuntu 18.04 Desktop 64bit
What did you do when you faced the problem?
Just tried to run the program.
Output:
Unable to load shared library 'OpenCvSharpExtern' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libOpenCvSharpExtern: cannot open shared object file: No such file or directory
Unhandled Exception: System.TypeInitializationException: The type initializer for 'OpenCvSharp.NativeMethods' threw an exception. ---> OpenCvSharp.OpenCvSharpException: Unable to load shared library 'OpenCvSharpExtern' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libOpenCvSharpExtern: cannot open shared object file: No such file or directory ---> System.DllNotFoundException: Unable to load shared library 'OpenCvSharpExtern' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libOpenCvSharpExtern: cannot open shared object file: No such file or directory
at OpenCvSharp.NativeMethods.core_Mat_sizeof()
at OpenCvSharp.NativeMethods.TryPInvoke() in C:\projects\opencvsharp\src\OpenCvSharp\PInvoke\NativeMethods.cs:line 136
--- End of inner exception stack trace ---
at OpenCvSharp.NativeMethods.TryPInvoke() in C:\projects\opencvsharp\src\OpenCvSharp\PInvoke\NativeMethods.cs:line 145
at OpenCvSharp.NativeMethods..cctor() in C:\projects\opencvsharp\src\OpenCvSharp\PInvoke\NativeMethods.cs:line 60
--- End of inner exception stack trace ---
at OpenCvSharp.NativeMethods.imgcodecs_imread(String filename, Int32 flags)
at OpenCvSharp.Mat..ctor(String fileName, ImreadModes flags) in C:\projects\opencvsharp\src\OpenCvSharp\Modules\core\Mat\Mat.cs:line 78
at ConsoleApp01.Program.Main(String[] args) in /home/suityou01/installation/test/ConsoleApp01/Program.cs:line 10
What did you intend to be?
To compile and run ok
I just had the same problem.
It seems to be a problem with:
.nuget\packages\opencvsharp4.runtime.ubuntu.18.04-x64\4.1.0.20190416\runtimes\ubuntu-x64\native\libOpenCvSharpExtern.so
which is only 3.5 MB in the release
4.1.0.20190416
.
I was able to get it working with an older version, e.g.:
4.0.1.20190326
.
where the file:
.nuget\packages\opencvsharp4.runtime.ubuntu.18.04-x64\4.0.1.20190326\runtimes\ubuntu-x64\native\libOpenCvSharpExtern.so
is 62 MB big
You might wanna downgrade your nuget packages accordingly.
Take care,
Martin
Reference
#667
to build from source. this worked for me. You need to remove the reference to the runtime package and after everything was built and installed from source it worked for me.
Something must be wrong in the runtime nuget package.
linux-vdso.so.1 => (0x00007ffe441ad000)
libgtk-x11-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0 (0x00007ff98a502000)
libgdk-x11-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0 (0x00007ff98a24d000)
libcairo.so.2 => /usr/lib/x86_64-linux-gnu/libcairo.so.2 (0x00007ff989f39000)
libgdk_pixbuf-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 (0x00007ff989d17000)
libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007ff989ac4000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007ff9897b3000)
The latest version of libOpenCvSharpExtern.so was made by the Ubuntu18.04 docker container in CircleCI.
Please try installing the same packages as it.
https://github.com/shimat/opencvsharp/blob/master/.circleci/config.yml
apt -y update
apt -y install wget unzip build-essential checkinstall cmake pkg-config yasm git gfortran libjpeg8-dev libpng-dev software-properties-common
add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
apt -y update && apt -y install libjasper1 libtiff-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine2-dev libv4l-dev
cd /usr/include/linux
ln -s -f ../libv4l1-videodev.h videodev.h
apt -y install libgtk2.0-dev libtbb-dev libatlas-base-dev libvorbis-dev libxvidcore-dev libopencore-amrnb-dev libopencore-amrwb-dev libavresample-dev x264 v4l-utils libwebp-dev tesseract-ocr libtesseract-dev libleptonica-dev
Just a follow up -- was able to get Arm64 running - Just simply compile it it --
For those that want what I did, since I used the Nvidia Nano for CUDA acceleration with DNN. Works like a charm!
cd opencv
mkdir release
cd release
cmake -D WITH_CUDA=ON \
-D CUDA_ARCH_BIN="5.3,6.2,7.2" \
-D CUDA_ARCH_PTX="" \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-D WITH_GSTREAMER=ON \
-D WITH_LIBV4L=ON \
-D WITH_FFMPEG=ON \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D BUILD_EXAMPLES=OFF \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j4
make install
sharpwood, aleksandar-lazic, MichalAnatolSkora, and migeyusu reacted with thumbs up emoji
migeyusu reacted with rocket emoji
All reactions
I am facing the same problem on CentOS 7 x64
[root@iZk1a852gcdx6se03w7daqZ native]# ldd libOpenCvSharpExtern.so
linux-vdso.so.1 => (0x00007ffc01dbb000)
librt.so.1 => /lib64/librt.so.1 (0x00007fb1f570e000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb1f54f2000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fb1f52ee000)
libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007fb1f50ec000)
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007fb1f4dd6000)
libz.so.1 => /lib64/libz.so.1 (0x00007fb1f4bc0000)
libm.so.6 => /lib64/libm.so.6 (0x00007fb1f48be000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fb1f45b7000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fb1f43a1000)
libc.so.6 => /lib64/libc.so.6 (0x00007fb1f3fd3000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb1f93f8000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fb1f3d71000)
[root@iZk1a852gcdx6se03w7daqZ native]#
what I missed or what should I check?
appreciate any help
thanks