Giter Site home page Giter Site logo

Comments (17)

JuanDYB avatar JuanDYB commented on June 14, 2024 1

I think it's more complicated, I'll try as you say but building OpenCv with GStreamer require to fill GStremer paths and other variables. Using CMake for windows and building winth VisualStudio it seems that works (show GStreamer in GetBuildInformation() method).

Thanks for your help.

from emgucv.

sn4k3 avatar sn4k3 commented on June 14, 2024

You just need to replace all dlls with the output emgucv compilation. I suspect you only need to replace the cvextern.dll

from emgucv.

JuanDYB avatar JuanDYB commented on June 14, 2024

Hi, I have rebuild the official OpenCv, but not EmguCv. I have try with EmguCv, but seems to be not so easy.
I thougt that it was possible only rebuilding OpenCv, since EmguCv it's only a wrapper.

from emgucv.

sn4k3 avatar sn4k3 commented on June 14, 2024

You can use openCV compilation too, copy the outputs to your project bin root. And this way not not use the emgucv runtime dist.

from emgucv.

JuanDYB avatar JuanDYB commented on June 14, 2024

I don't understand so well. You mean install EmguCv nugget and after that copy binaries from OpenCv Build?
I have try this and didn't work. It sais that cvextern.dll is not found.

from emgucv.

sn4k3 avatar sn4k3 commented on June 14, 2024

Yes, just install the emgucv nugget and copy the dlls. It should work on bin root. However in a normal not published compilation they are located under runtimes\win-x64\native

 Directory: UVtools\UVtools.UI\bin\Debug\net6.0\runtimes\win-x64\native

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          19/09/2020    01:46        4369408 av_libglesv2.dll
-a---          18/10/2023    01:41         327576 concrt140.dll
-a---          16/09/2023    14:03       35899904 cvextern.dll
-a---          20/09/2023    19:11        1607088 libHarfBuzzSharp.dll
-a---          10/01/2024    22:47        9414064 libSkiaSharp.dll
-a---          18/10/2023    01:41          35704 msvcp140_1.dll
-a---          18/10/2023    01:41         267160 msvcp140_2.dll
-a---          18/10/2023    01:41          50072 msvcp140_atomic_wait.dll
-a---          18/10/2023    01:41          31640 msvcp140_codecvt_ids.dll
-a---          18/10/2023    01:41         578384 msvcp140.dll
-a---          17/10/2023    23:37       26353152 opencv_videoio_ffmpeg481_64.dll
-a---          18/10/2023    01:41          49560 vcruntime140_1.dll
-a---          18/10/2023    01:41         109440 vcruntime140.dll

from emgucv.

JuanDYB avatar JuanDYB commented on June 14, 2024

Hi,
It seems that I don't have the same dlls.
If I install EmguCv nugget I get this dlls in bin/Debug directory.

bin/Debug

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        06/04/2024     22:28                runtimes
-a----        18/10/2023      3:37          24520 Emgu.CV.Bitmap.dll
-a----        18/10/2023      2:59         891336 Emgu.CV.dll

And after that I have created runtimes directory as you mentioned and I have put all the dlls that I have in install/x64/vc17/bin folder of OpenCv output.
By doing this I'm getting DllNotFoundException because it seems EmguCv is searching for a dll named cvextern.dll

bin/Debug/runtime/win-x64/native

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        04/04/2024     16:32        3082752 opencv_calib3d490.dll
-a----        04/04/2024     16:11        7384064 opencv_calib3d490d.dll
-a----        04/04/2024     16:28       14705664 opencv_core490.dll
-a----        04/04/2024     16:10       23786496 opencv_core490d.dll
-a----        04/04/2024     16:34        7255040 opencv_dnn490.dll
-a----        04/04/2024     16:12       17175040 opencv_dnn490d.dll
-a----        04/04/2024     16:30         905216 opencv_features2d490.dll
-a----        04/04/2024     16:11        2667520 opencv_features2d490d.dll
-a----        04/04/2024     16:29         585728 opencv_flann490.dll
-a----        04/04/2024     16:10        1609216 opencv_flann490d.dll
-a----        04/04/2024     16:40        6283264 opencv_gapi490.dll
-a----        04/04/2024     16:14       17370624 opencv_gapi490d.dll
-a----        04/04/2024     16:32         346112 opencv_highgui490.dll
-a----        04/04/2024     16:12         910848 opencv_highgui490d.dll
-a----        04/04/2024     16:30        3586048 opencv_imgcodecs490.dll
-a----        04/04/2024     16:11        8611840 opencv_imgcodecs490d.dll
-a----        04/04/2024     16:30       29279232 opencv_imgproc490.dll
-a----        04/04/2024     16:11       45126656 opencv_imgproc490d.dll
-a----        04/04/2024     16:29         670208 opencv_ml490.dll
-a----        04/04/2024     16:10        1698304 opencv_ml490d.dll
-a----        04/04/2024     16:38        1435136 opencv_objdetect490.dll
-a----        04/04/2024     16:13        3610112 opencv_objdetect490d.dll
-a----        04/04/2024     16:30         830464 opencv_photo490.dll
-a----        04/04/2024     16:11        1881600 opencv_photo490d.dll
-a----        04/04/2024     16:32        1001984 opencv_stitching490.dll
-a----        04/04/2024     16:12        2457600 opencv_stitching490d.dll
-a----        04/04/2024     16:37         836608 opencv_video490.dll
-a----        04/04/2024     16:13        2070528 opencv_video490d.dll
-a----        04/04/2024     16:32         844288 opencv_videoio490.dll
-a----        04/04/2024     16:11        2054656 opencv_videoio490d.dll
-a----        02/04/2024      7:55       26314752 opencv_videoio_ffmpeg490_64.dll

from emgucv.

sn4k3 avatar sn4k3 commented on June 14, 2024

Theres not an option to combine all that into a single dll?
If you want emgucv runtime you need to get the package https://www.nuget.org/packages/Emgu.CV.runtime.windows

from emgucv.

JuanDYB avatar JuanDYB commented on June 14, 2024

I didn't see any cmake option to build as single dll.
I wan't to use my OpenCv build because it seems that default compilation of OpenCv doesn't include Gstreamer backend. That's why I'm trying to do in that way.

from emgucv.

sn4k3 avatar sn4k3 commented on June 14, 2024

Better ask to @emgucv
But you can also edit the bat and add WITH_GSTREAMER:BOOL=TRUE, not sure if only that will work

from emgucv.

sn4k3 avatar sn4k3 commented on June 14, 2024

See: https://discourse.cmake.org/t/how-to-combine-all-dlls-from-subproject-into-one-dll/7235/5
BUILD_opencv_world which emgucv is using here

from emgucv.

JuanDYB avatar JuanDYB commented on June 14, 2024

You are sugesting to use this cmake option to build OpenCv and rename as cvextern.dll?

from emgucv.

sn4k3 avatar sn4k3 commented on June 14, 2024

Yes, it should combine all in one dll and then you can try it as cvextern.dll

from emgucv.

emgucv avatar emgucv commented on June 14, 2024

The none-GPU release of Emgu CV static linked OpenCV into cvextern.dll. You can't just replace it with opencv dlls. You will need to re-build Emgu CV with the same configuration as Open CV to generate the cvextern.dll that contains the Open CV bits with GStreamer support.

The GPU release of Emgu CV use dynamic linked opencv_world.dll. You can download this nuget package for the dlls: https://github.com/emgucv/emgucv/releases/download/4.8.0/Emgu.CV.runtime.windows.cuda.4.8.0.5324.nupkg
Renamed it with extension of ".zip" and you should be able to unzip the file to get the dlls.

If you build opencv with GStreamer and BUILD_opencv_world enabled, you can replace the opencv_world.dll file from the above Emgu CV GPU runtime package with your own. In-theory that should give you GStreamer support using Emgu CV. We have not tested it and we do not officially support it.

from emgucv.

JuanDYB avatar JuanDYB commented on June 14, 2024

Hi,

I have tried to rebuild Emgucv from scratch following documentation.

  1. Clone git repository
  2. Executing Build_Binary_x86-64_doc.bat
  3. Open build_x86_64 folder with cmake, setting new variable GSTREAMER_DIR=C:/gstreamer/1.0/msvc_x86_64
  4. Click on configure and cmake fill WITH_GSTREAMER=ON and all the Gstreamer options paths.
  5. Click on generate
  6. Open build_x86_64/emgucv.sln. Set Release mode and rebuild cvextern project.
  7. Copy libs/runtimes directory to new VisualStudio project bin/Degug (project has EmguCv nugget installed)

It seems it isn't working. At starting I have called CvInvoke.BuildInformation and it is throwing System.TypeLoadException

from emgucv.

emgucv avatar emgucv commented on June 14, 2024

You will also need to copy all the GStreamer dlls to the folder that contains cvextern.dll.

If you still got the System.TypeLoadException after that, follow this instruction to use dependecy walker to find out what dependecy is missing from the folder of the dlls:
https://www.emgu.com/wiki/index.php/Download_And_Installation#Are_you_missing_any_dependency.3F

If dependency walker reports missing dependency, copy them over to the folder where you have the "cvextern.dll".

from emgucv.

JuanDYB avatar JuanDYB commented on June 14, 2024

Finally I did it!
I copied all dlls in C:/gstreamer/1.0/msvc_x86_64/bin to runtimes dir inside bin, at same level as cvextern.dll.
Now it seems to work, and I see GSTREAMER enabled in getBuildInformation().

But I'm having problems to build Gstreamer pipeline. I don't know if maybe gstreamer needs more dependencies or somethig like that.

string command = "appsrc ! videoconvert ! mfxh264enc ! video/x-h264, stream-format=byte-stream, profile=baseline ! send-config=true rtph264pay pt=96 ! udpsink host=127.0.0.1 port=5004";

[ WARN:[email protected]] global cap_gstreamer.cpp:2250 cv::CvVideoWriter_GStreamer::close_ OpenCV | GStreamer warning: No source in GStreamer pipeline. Ignore
[ERROR:[email protected]] global cap.cpp:645 cv::VideoWriter::open VIDEOIO(GSTREAMER): raised OpenCV exception:
 
OpenCV(4.9.0) C:\CMake\opencv\opencv\modules\videoio\src\cap_gstreamer.cpp:154: error: (-215:Assertion failed) ptr in function 'cv::`anonymous-namespace'::GSafePtr<struct _GstElement>::get'

Thanks for your support.

from emgucv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.