emgucv

Why is Opencv Findcontour behaving differently in Emgu c#?

旧巷老猫 提交于 2019-12-02 09:31:41
Hi in opencv c+ method Findcontours return the array hierarchy and to get the boundaries of the hole I can get the hierarchy . how can i get these boundaries in emgu cv please any help? how can i find holes in emgu cv? You can get the Contour hierarchy in Emgucv by using this following code. Image<Bgr, byte> Img_Result_Bgr = Img_Source_Bgr.Copy(); Image<Gray, byte> Img_Org_Gray = Img_Source_Bgr.Convert<Gray, byte>(); Image<Gray, byte> Img_CannyEdge_Gray = new Image<Gray, byte>(Img_Source_Bgr.Width,Img_Source_Bgr.Height); Img_CannyEdge_Gray = Img_Org_Gray.Canny(10, 50); Img_Org_Gray.Dispose();

EmguCV Out of memory exception in x86 release mode only-Sharpening Images

穿精又带淫゛_ 提交于 2019-12-02 08:56:53
Im trying to increase the sharpness of an image using EmguCV Image<Bgr, Byte> myImage = new Image<Bgr, Byte>(new Bitmap(pictureBox1.Image)); float[,] matrixKernel = new float[3, 3] { { 0,-1, 0 }, {-1, 5,-1 }, { 0,-1, 0 } }; ConvolutionKernelF matrix = new ConvolutionKernelF(matrixKernel); Image<Bgr, float> result = myImage.Convolution(matrix); Image<Bgr, Byte> BGRResult = result.ConvertScale<byte>(1, 0); e.Result = BGRResult.ToBitmap(); myImage.Dispose(); result.Dispose(); BGRResult.Dispose(); The code works fine for medium resolution images,but when using high resolution images eg: 6000X4000

Emgu CV Unable to load DLL 'cvextern' in deployed project

故事扮演 提交于 2019-12-02 08:36:36
I'm using EmguCV for face detection in my ASP.NET project. When I run the project from Visual Studio, everything works correct. Then I published release build via Folder profile and then just uploaded this published build to smarterasp.net. Application is working in general. But when the application is trying to detect faces in images, an exception is throwed: System.AggregateException: One or more errors occurred. ---> System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'cvextern': The

Looking for a function for motion detection on emgucv

故事扮演 提交于 2019-12-02 08:34:58
问题 I am new to emgu cv; I'm trying to find a code that makes motion detection. I tried this: CvInvoke.cvAbsDiff(frame, _backgroundImage, BgDifference); ... but I have lighting problems. I want to get white the pixels where there was motion, and then draw a rectangle there only one rectangle, but I take more areas with white pixels. What do I need to do? Could I try ananother function? 回答1: Convert a single frame to grayscale. Convert a new frames from real time into grayscale. Make abstractions

Resizing the image in C# and sending it to OpenCV results in distorted image

主宰稳场 提交于 2019-12-02 08:32:36
This is a follow-up question related to this one . Basically, I have a DLL which uses OpenCV to do image manipulation. There are two methods, one accepting an image-Path , and the other one accepting a cv::Mat . The one working with image-path works fine. The one that accepts an image is problematic. Here is the method which accepts the filename (DLL): CDLL2_API void Classify(const char * img_path, char* out_result, int* length_of_out_result, int N) { auto classifier = reinterpret_cast<Classifier*>(GetHandle()); cv::Mat img = cv::imread(img_path); cv::imshow("img recieved from c#", img); std:

Work with matrix in emgu cv

南楼画角 提交于 2019-12-02 08:10:39
问题 I have a matrix (2D) of an image in EMGU cv,how can I fill the rest of the matrix with zeros but keep a certain area(rectangle) with the original data? 回答1: Method 1 One way to achieve what your after is to access the Data of the Matrix directly and set the values to '0' the following code will set the lower quarter of 'My_Matrix' to 0 where all other values will remain 20. Matrix<double> My_Matrix_Image = new Matrix<double>(8,10); My_Matrix_Image.SetValue(20); //set all values of Matrix to

Work with matrix in emgu cv

南笙酒味 提交于 2019-12-02 06:53:30
I have a matrix (2D) of an image in EMGU cv,how can I fill the rest of the matrix with zeros but keep a certain area(rectangle) with the original data? Chris Method 1 One way to achieve what your after is to access the Data of the Matrix directly and set the values to '0' the following code will set the lower quarter of 'My_Matrix' to 0 where all other values will remain 20. Matrix<double> My_Matrix_Image = new Matrix<double>(8,10); My_Matrix_Image.SetValue(20); //set all values of Matrix to 20 for(int i = 4; i< My_Matrix_Image.Height; i++) { for (int j = 5; j < My_Matrix_Image.Width; j++) {

How to get video stream from webcam in emgu cv?

怎甘沉沦 提交于 2019-12-02 06:21:52
问题 I'm using emgu cv in c#. I need to know How I can get the video stream from my webcam(default webcam)in emgu cv? 回答1: You can use the following code to make an app to capture and display video stream: public class CameraCapture { private Capture capture; //takes images from camera as image frames private bool captureInProgress; private void ProcessFrame(object sender, EventArgs arg) { Image<Bgr, Byte> ImageFrame = capture.QueryFrame(); //line 1 CamImageBox.Image = ImageFrame; //line 2 }

Ordering 2d/3d object behind other element

痴心易碎 提交于 2019-12-02 03:56:43
As you can see in the link , I have two elements: first is image element which is taken from camera (using EmguCV) and the other one is viewport3d which renders 3d object. I also include 2d object (see the rectangle). When I run my program I see this . Yes indeed, the object (hand) will be ordered in front of the image. The question is how to order 2d/3d object behind the hand object? Is it possible to do it using single camera? Just like this one . Thanks in advance for your answers. There are two ways of doing it. Use kinect depth map to find the distance of hand from camera. Do image

Fourier transform of an image in EmguCV

Deadly 提交于 2019-12-02 03:43:16
Can anyone tell me if there is an inbuilt function present in emgucv 2.3 for finding out fourier transform of images ? Thanks in advance Chris From my answer Fourier Transform + emgucv The function you are after is CvInvoke.cvDFT it is technically calling the opencv method but it should be what your after Here is the code that splits the Imaginary and Real parts from cvDFT: Image<Gray, float> image = new Image<Gray, float>(open.FileName); IntPtr complexImage = CvInvoke.cvCreateImage(image.Size, Emgu.CV.CvEnum.IPL_DEPTH.IPL_DEPTH_32F, 2); CvInvoke.cvSetZero(complexImage); // Initialize all