Hello Guys , is there any way to convert array or bitmap or whatever to The type Mat of openCv ..
I have a image object and i want to make usable for openCv , so first i need to convert it to Mat
Hello Guys , is there any way to convert array or bitmap or whatever to The type Mat of openCv ..
I have a image object and i want to make usable for openCv , so first i need to convert it to Mat
Hi AhmedWassimBENSALEMENISo-3626,
To use OpenCvSharp, you need to add both OpenCvSharp4 and OpenCvSharp4.runtime.* packages to your project.
Right-click your project namre->Manager NuGet Packages->Browse-> Search and Install them.
Then you can achieve it via BitmapConverter.ToMat() method.
Here is my test code you can refer to.
Image img = Image.FromFile(@"C:\Users\Pictures\home.PNG");
Bitmap bmpScreenshot = new Bitmap(img);
var imageMat = OpenCvSharp.Extensions.BitmapConverter.ToMat(bmpScreenshot);
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentationto enable e-mail notifications if you want to receive the related email notification for this thread.
@DanielZhang-MSFT
Hello Sir ,
Thank your for help , i want to ask if also i can do the image processing with OpenCvSharp4 that i installed with nuget ?
i mean does it have the basic fucntion for image procssing?
Hi @AhmedWassimBENSALEMENISo-3626,
As document said that OpenCvSharp4 is an OpenCV wrapper for .NET. Since this package only contains the core managed library, another native binding package (OpenCvSharp4.runtime.*) for the operating system is required.
And it will encounter the error "Unable to load DLL'OpenCvSharpExtern': The specified module could not be found" without OpenCvSharp4.runtime.
Best Regards,
Daniel Zhang
9 people are following this question.
Insert a node as child ,before or after a node in nested dynamic JSON Node using C#
Visual Studio 2019: Undefined behavior in a C++/CLI wrapper project.
Example for how to get Package Metadata from Azure DevOps Rest-Api Artifacts using c#
How to collapse individual nested grids/stackpanels inside a grid?