emgucv

Image conversion in OpenCV C#

本秂侑毒 提交于 2019-12-02 00:43:55
问题 Image<bgr,byte> WeightedImg; . . double color; for (int i = 0; i < dataArray.Length; i++){ color = dataArray[i, 2]; WeightedImg.Bitmap.SetPixel(x, y,Color.FromArgb((int)Math.Ceiling(color * R), (int)Math.Ceiling(color * G),(int)Math.Ceiling(color * B))); } this line: WeightedImg.Bitmap.SetPixel(x, y,Color.FromArgb((int)Math.Ceiling(color * R), (int)Math.Ceiling(color * G),(int)Math.Ceiling(color * B))); makes the program crash .. I want to set a pixel in a WeightedImg according to a double

Color Image Quantization in .NET

跟風遠走 提交于 2019-12-01 22:24:39
I want to reduce the number of unique colors of a bitmap in c#. The reason I want to do this is that an image which is initially created with three color but due to many factors (including compression) has now more than three colors (i.e neighbour pixels has affected each other) Any idea of how to do that? The solution maybe something to convert the whole bitmap from RGB to Indexed color system or some function that can be applied to a single pixel. Any GDI+ or Emgu (opencv) solutions are good for me. Check out nQuant at http://nquant.codeplex.com . This yields much higher quality than the

How to cut a sub-part of an image using Emgu CV (or OpenCV)?

妖精的绣舞 提交于 2019-12-01 17:59:24
I want to cut a sub-purt of an image (or crop it) using Emgu CV (or OpenCV) and calculate average color of that part; looking for changes. Thanks Set the ROI (Region of Interest) of the image you are working with this will mean any calculation is only done over this area. image.ROI = new Rectangle(x,Y,Width,Height); Calculate the Average of the ROI where "TYPE" is image dependant Bgr for colour Gray for Grayscale TYPE average = image.GetAverage(image); When youve finished reset your image ROI so you can see the whole image again. All the process does is loop through each pixel adds its value

It is possible to get an IntPtr from an int[] array?

China☆狼群 提交于 2019-12-01 17:07:27
Greetings. In C#: If I have an int[] array declared like this int[] array = new array[size]; there is an way to get the IntPtr from this array? The thing is that I'm using the EmguCV framework, and there is an constructor to create an image which takes an IntPtr to the pixel data, in order to build an image from an array (int[]). Image<Gray,Int32> result = new Image<Gray,int>(bitmap.Width,bitmap.Height,stride,"**array.toPointer??**"); By the way if someone could told me how to calculate the stride, that would be great. You should be able to do this without unsafe code using GCHandle . Here is

EmguCV cvextern System.DllNotFoundException

Deadly 提交于 2019-12-01 16:28:45
I am trying to run the example of LicensePlateRecognition in EmguCV 3.1. But I always get the error System.DllNotFoundException and the message is that "cvextern.dll cannot be loaded". I am running Windows 7 with Visual Studio 2013 (the computer is provided by my company). I copied the said dll and some other dlls in the folder to the debug folder (the profile is set to debug mode, and I tried both x86 and x64 versions). After getting the error again and again I started to suspect that it's because of my video card driver (some Google results suggested so). I updated that and the error

EmguCV cvextern System.DllNotFoundException

旧时模样 提交于 2019-12-01 15:45:42
问题 I am trying to run the example of LicensePlateRecognition in EmguCV 3.1. But I always get the error System.DllNotFoundException and the message is that "cvextern.dll cannot be loaded". I am running Windows 7 with Visual Studio 2013 (the computer is provided by my company). I copied the said dll and some other dlls in the folder to the debug folder (the profile is set to debug mode, and I tried both x86 and x64 versions). After getting the error again and again I started to suspect that it's

Eye and Mouth detection from face using haar-cascades

蹲街弑〆低调 提交于 2019-12-01 14:24:56
I have extracted eyes and mouth from the face, but want to extract emotions from eyes and mouth.. However, mouth is not detected properly.. This is my code.. private void timer1_Tick(object sender, EventArgs e) { using (Image<Bgr, byte> nextFrame = cap.QueryFrame()) { if (nextFrame != null) { // there's only one channel (greyscale), hence the zero index //var faces = nextFrame.DetectHaarCascade(haar)[0]; Image<Gray, byte> grayframe = nextFrame.Convert<Gray, byte>(); Image<Gray, Byte> gray = nextFrame.Convert<Gray, Byte>(); Image<Gray, Byte> gray1 = nextFrame.Convert<Gray, Byte>(); var faces =

Eye and Mouth detection from face using haar-cascades

寵の児 提交于 2019-12-01 14:00:21
问题 I have extracted eyes and mouth from the face, but want to extract emotions from eyes and mouth.. However, mouth is not detected properly.. This is my code.. private void timer1_Tick(object sender, EventArgs e) { using (Image<Bgr, byte> nextFrame = cap.QueryFrame()) { if (nextFrame != null) { // there's only one channel (greyscale), hence the zero index //var faces = nextFrame.DetectHaarCascade(haar)[0]; Image<Gray, byte> grayframe = nextFrame.Convert<Gray, byte>(); Image<Gray, Byte> gray =

Removing background from _capture.QueryFrame()

ぃ、小莉子 提交于 2019-12-01 13:00:47
问题 I am using Emgucv and i would like to know if it possible to remove the background from a _capture.QueryFrame and to be able to focus on the nearest object on my camera? Thanks in advance. 回答1: Yes this is quite possible take a look at the " MotionDetection " example provided with EMGU this should get you started. Effectively the code that removes the foreground is effectively named "_forgroundDetector" it is the "_motionHistory" that presents stores what movement has occurred. The example

Capturing a Multicast UDP Video stream using OpenCV

我怕爱的太早我们不能终老 提交于 2019-12-01 11:25:54
I have a multi-cast UDP Video stream that I need my OPenCV (Emgu ) 2.4.x app to capture and process ("client"). On the client, I can capture the stream using VLC (udp://xx.yy.zz.aaa:1234, However the my app fails to capture this udp stream. My code is quite simple ( Capture cap = new Capture ("udp://@212.1.1.1:1234"); p.s. I have tried with and 2/o the @ also tried rtp on that address. No luck :-/ Does OpenCV directly allow "capture" of UDP streams? or do I need to run VLC on the client to re-stream the video as rtp or http or some other....? Thanks. I finally figured this out and sharing in