Displaying, overlaying and interpreting live video feed in WinForms - c#

I am starting a new project to show live video in a Windows form from an attached web cam and overlay that video with windows controls (buttons etc). Additionally I would like to do some image correction to remove distortion on the fly and do some edge detection.
I'm confused as to which library might be best suited for this.
OpenCVSharp - Can handle the correction / detection, not sure if overlay / live feed is possible.
DirectShow/DirectShow.Net - Do I need to code filters up for the
overlay, how to handle edge detection?
AForge.net - It's been recommended but I'm not sure it is as capable
Does anyone have experience of these or other libs that might be suitable for access from .Net?

If you only want to work with the vision part then AForge.net is your best bet. I have used it in the past and it was pretty good for video/feed stuff. Don't expect to do something with your audio later on though since AForge.NET only supports Vision related stuff. Personally I wouldn't use DirectShow since that is pretty old and sometimes requires you to do some complex interop tricks to get what you want. If you want to go the DirectShow way at least use DirectShow.NET.

I believe you can accomplish that with OpenCVSharp and the instructions from transparent image overlay.

Related

Fast pixel drawing in WPF

I would like to write a simple ray tracer using WPF. It is a learning project and thus I favour configurability over performance (otherwise I'd go for C++).
I still want relatively fast pixel drawing. A previous question on StackOverflow contains code to achieve this in WPF, by obtaining a GDI bitmap. From the relatively little I know about Windows programming,
GDI is slow
DirectX is fast
WPF uses DirectX underneath (not sure which parts of WPF though)
Is it possible to obtain pixel-level access using DirectX (not GDI) through the WPF Canvas (or similar)?
I will also consider suggestions for incorporating DirectX API calls within a WPF window (alongside other WPF controls) if that is possible.
Thanks in advance.
Interesting, but with raytracing, writing the pixels to the screen will (should) not be the slow part. You can use WriteableBitmap for the purpose, though. It's certainly quick enough for what you want.
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.writeablebitmap.aspx
(For info, I use it in this emu/IDE - http://0x10c-devkit.com/ - and it can refresh a low res display with great performance. There's the source to that on the github repository, the LEM1802 plugin.)
Ah, this bit: https://github.com/kierenj/0x10c-DevKit/blob/master/PluginAPI/NyaElektriska.LEM1802/GPU.cs - see UpdateDisplay.
Another solution is WriteableBitmapEx. It extends the builtin WriteableBitmap.
There is an open Source Project Called Direct Canvas wich is A hardware accelerated, 2D drawing API that supports vector graphics, multimedia files, extensible pixel shaders, blending modes and more!
http://directcanvas.codeplex.com/
Demo http://www.youtube.com/user/jdollah69#p/u

WPF - creating (image) wall or prezi effect?

I want to develop Windows WPF application using Kinect with great GUI/NUI. I've found really nice examples of user interfaces that could be even more admirable using Kinect device. For example: prezi effects - http://prezi.com/jipjiqvj6dsc/about-perspective/ one big wall and really nice zooming / moving. I was thinking about something similar for Metro UI too.
Do you know how to create those nice gui elements in the WPF? Or maybe you heard about good resources about this topic?
A good starting point is Josh Blake's upcomming book (you can get the MEAP preview now) and the "NaturalShow" sample app it includes. You can get that code at http://blakenui.codeplex.com/
I've found really nice project which includes solution for my problem: http://jarloo.com/code/projects/jot/
Nice discussion on stackoverflow: Pan & Zoom Image

How to draw an unfilled square on top of a stream video using a mouse and track the object enclosed in the square automatically in C#?

I am making an object tracking application. I have used Emgucv 2.1.0.0
to load a video file
to a picturebox. I have also taken the video stream from a web camera.
Now, I want
to draw an unfilled square on the video stream using a mouse and then track the object enclosed
by the unfilled square as the video continues to stream.
This is what people have suggested so far:-
(1) .NET Video overlay drawing(DirectX) - but this is for C++ users, the suggester
said that there are .NET wrappers, but I had a hard time finding any.
(2) DxLogo sample
DxLogo – A sample application showing how to superimpose a logo on a data stream.
It uses a capture device for the video source, and outputs the result to a file.
Sadly, this does not use a mouse.
(3) GDI+ and mouse handling - this area I do not have a clue.
And for tracking the object in the square, I would appreciate if someone give me some research paper links to read.
Any help as to using the mouse to draw on a video is greatly appreciated.
Thank you for taking the time to read this.
Many Thanks
It sounds like you want to do image detection and / or tracking.
The EmguCV ( http://www.emgu.com/wiki/index.php/Main_Page ) library provides a good foundation for this sort of thing in .Net.
e.g. http://www.emgu.com/wiki/index.php/Tutorial#Examples
It's a pretty meaty subject with quite a few years and different branches of research associated with it so I'm not sure anyone can give the definitive guide to such things but reading up neural networks and related topics would give you a pretty good grounding in the way EmguCV and related libraries manage it.
It should be noted that systems such as EmguCV are designed to recognise predefined items within a scene (such as a licence plate number) rather than an arbitory feature within a scene.
For arbitory tracking of a given feature, a search for research papers on edge detection and the like (in combination with a library such a EmguCV) is probably a good start.
(You also may want to sneak a peek at an existing application such as http://www.pfhoe.com/ to see if it fits your needs)

C# Video Playback

I'm looking at trying to create a simple 'slider puzzle' game. You've seen the ones, you have an image and you shuffle the tiles.
However, I want to make one that will play back videos instead. What I'm trying to determine is whether it's possible to playback a video in C# and render the video on different controls (probably buttons, or panels). I've spotted the Microsoft.DirectX.AudioVideoPlayback classes but haven't found much documentation on them yet.
So to throw it up in the air, is this going to be possible to do without too much difficulty? Are there any useful (free) libraries that might help me along?
Have a look at DirectShowNet that wraps the DirectShow API, in the samples page there is a sample called PlayWnd the shows how to play a video file.
Depending upon how large and how long your video sources are, you could accomplish this very simply by first converting your videos to animated GIFs. A .Net PictureBox control will display and animate a GIF automatically, and you could easily use PictureBoxes for your tiles.
One big advantage of this approach is that (thanks to Mono) your application could work unaltered on Windows, Mac and the iPhone (also Linux and a couple others).

Where can I find, or how can I build, a cartoonizer for C#?

I am working on the development of a Massively Multiplayer Online Role Playing Game (MMORPG) in .NET using C# and Silverlight. One of the features that has been requested for this game is to allow players to upload their own avatars.
Rather than displaying the uploaded images in their raw forms, we want to convert the images to a cartoon form--in other words to cartoonize the image.
Several sites which can accomplish such a task are listed at http://www.hongkiat.com/blog/11-sites-to-create-cartoon-characters-of-yourself/
I realize that these sites are applying an image filter to create the cartoon image. Frankly, I have no reasonable idea what these cartoon image filter algorithms might look like or if there is anything already available in C# or .NET that I could use. If there are no libraries available, I am curious how difficult it would be to roll my own.
This is a minor game feature so I am not interested in devoting a week or more of coding time to implement this. However, if I can code up what I need within a day, then it is probably viable.
At this point, I am primarily looking for guidance as to
what is possible
what libraries are already available (preferably as open source)
where i may find additional information
any other advice or guidance you may be able to provide
Thank you in advance!
Apparently you apply a Gaussian Blur filter to the image. Then you sharpen the image. Perhaps the AForge libraries would help you out.
I've used code from the image processing lab on code project before with success. (update: here's the library it uses)
Christian Graus also has written a whole series on GDI image processing which I found useful (and has the effects listed above for filtering capabilities).

Categories

Resources