Grab picture from web cam in WPF Application? - wpf

I am using web cam in WPF application. I am using Expression Encoder for video capture. for video capture I have created Job and its working properly. While I want to get picture with same resolution as video is. for this I am using ffmpeg to extract first frame from video. but quality of image is very low. the priority is that image quality should be best of attached web cam and resolution should be as much as video is.
Either we have any better option in Expression Encode for taking picture or kindly help me with any alternative.

You can have a look at this control:
The control provides the following functionalities:
Gets a list of available web camera devices on a system.
Displays a video stream from a web camera device.
Gets the current image being captured.
Requirements
The WPF version of the control is implemented using .NET Framework 4 Client Profile.
The control uses the VMR-9 renderer filter available since Windows XP SP2.
The control supports both x86 and x64 platform targets.

For some reason, accessing images from a web cam is far more complicated then it should be. While I have not used the Expression Encode application, I can provide you with two links to CodePlex, where you can find two different libraries that could help you to solve your problem. Please see the following pages:
WebCam Library for WinForm and WPF with C# and VB.NET
WPF MediaKit - For webcam, DVD and custom video support in WPF
Alternatively, if you're happy with using Expression Encode, then you could take a look at the following links:
Extracting still pictures from movie files, with C#
Extract frames from video files – The Code Project – Multimedia

I would recommend AForge.Net, it works flawless, free and licensed under LGPL v3 license, it also seems to work in both 32 and 64 bit.
The only drawback is that you need ~400 kb worth of dlls to get the webcam control.

Related

Building assembly and adding embedded resource at run-time - Scenario included

EDIT: To better clarify the issue, I've included a scenario:
Scenario: There is an education institution that produces video tutorials. We were asked to provide a solution on how to protect the video files so as not to give access to the real video files to the users. The videos are published "offline" using DVD ROM.
Solution: We decided to embed the video files into the silverlight assembly and write a Silverlight OOB application that takes advantage of MediaElement control to play video content. This control accepts video resource of type Stream which makes it possible to use Application.GetResourceStream method to read the embedded resource as an stream and pass it to MediaElement.
Design: We need to write two applications:
One that accepts one or more video files from education institute operator and creates an assembly and embeds the video files into the assembly.
Another application that reads the contents of the newly-created assemblies and plays the video content using MediaElement control.
Problem:
How to generate a silverlight assembly and embed video resources to it "programmatically" using a C# windows app or Silverlight app? I wanted to use AssemblyBuilder class, but it does not contain Save method in silverlight.
Any help would be greatly appreciated.
Assuming you feel you need to embed your video in the way you described, rather than stream it, then you do not need to run the creation of modules on the Silverlight client.
Have the Silverlight app upload the Video to the matching Silverlight host
Now you have full access to the .Net stack and can create pretty much anything you need (including compiling projects or assemblies on the fly and using AssemblyBuilder).
If this does not cover your situation, please clarify the question further.

Adobe flex or WPF to write a visually rich desktop application

I'm interested in making a desktop application which I would want to use as a Desktop Manager. This kind-of goes to Desktop Enhancement Category. My requirements are:
Application has to be visually rich, with panels sliding,fading,wiping,rotating and etc.
It should also support flash playback. (swf, flv)
Animations/Transitions should run smoothly.
Lower CPU Usage.
My question is which is a better option to build this application. Microsoft's "WPF" or Adobe Flex(running in Adobe Air to run on desktop). And also respond as why it is better.
Be suspicious of anyone who will give you an answer like "Definately use xyz" to this question. There are pros and cons to both sides.
First, I think you might be confusing what WPF and Air are... WPF is a presentation layer on top of the .Net framework, where Air is a framework by itself. Apples and Oranges. If you want an analog to what Air is for the .Net stack, you probably want to look at Silverlight Out-Of-Browser, which is a much closer comparison to Air.
What is the difference, then, between WPF and Sliverlight OOB? Again, WPF sits on top of a very large .Net framework where Sliverlight OOB is a very light framework (in comparison) like air. It is the difference between a 200 MB download/install and a 12 MB download/install.
So, that being said, I think you should also ask what platforms this needs to run on. Silverlight OOB runs on Mac and Windows where WPF only runs on Windows. Air runs on Mac, Windows and Linux.
The next thing that I see is that you need to do SWF and FLV playback. This will be easier to achieve with Air, since it is native. You CAN do this with Silverlight OOB but you will find yourself rigging something up where you host an HTML control and run the flash movie inside the HTML control. It is a bit more clunky, but it will work.
Other than that, Air and SLOOB are very similar in features. It then comes down to your team and the expertise, IMO. If they are already familiar with the WPF/Silverlight, then a SLOOB app is well suited with minimal ramp-up. If your designers are more familiar with the Adobe suite of tools, then it might be easier to build a shiny app using Air.
In all, the decision between Air and Silverlight/WPF really comes down to preference. That is, once you get past any particular techincal limitations like the flash playback or OS support.
Hope this helps,
Brian

play video in silverlight?

How do yo play a video with silverlight?
does Visual Studio come with a video player component build in? or do I need to make a video player?
As often is the case, it depends what you're requirements are.
You can use the media element which comes with Silverlight (msdn info here) , however, that means building everything from scratch, it does not come with a "player chrome", as in buttons and visual styles.
If you want a pre-built "player", there's at least a couple of options, the Expression Encoder tool (a free version is available), comes with a number of Silverlight players that you can freely use and modify if you wish. You find them under the "templates" section in expression encoder tool.
Another option is to use the "Microsoft Media Platform: Player Framework" (formerly known as Silverlight Media Framework (SMF)), which is a open source project which Microsoft is involved in, it comes with a fully featured "player" and is built on industry standards, you can find it at http://smf.codeplex.com.
Good luck!
In SL:
<MediaElement x:Name="MyVid"
Source="http://abc.xyz.com/MyVid.wmv"
Height="250"
Width="350"
AutoPlay="True"/>
Server-side needs to support MMS (RTSP protocol - streaming) or progressive downloads (MMS on the MediaElement's side takes care of both). Videos should conform to the SMPTE 421M video codec standard (VC-1).

Draw screenshot of Silverlight application using Visio?

Is there any way I could draw screenshot design of Silverlight application using Visio?
Or any other tool I could use to draw screenshot of Silverlight application?
Thank you.
I'm not sure exactly what you're asking, but here are two answers:
If you're looking for an application to create a mock-up design of a Silverlight application, I'd recommend using Expression Blend 3 (version 3 or greater) with Sketch Flow. Sketch Flow allows you to create a real "sketch" of a user interface that can later be turned into a Silverlight application. It's great for application design purposes.
You can also use Powerpoint, Excel, Access or other Office applications to make rough sketches of application flow, but these usually appear really crude.
If you're looking to take screen shots of existing Silverlight applications, I'd recommend Jing (free), SnagIt ($), or the free Snipping Tool in Windows 7 or Vista.
The best mock-up design tool I have ever used (and still use almost every day) is Balsamiq Mockups.

How to Convert TIFF to JPG Inside Silverlight, client side, using a control or a class/function?

We are creating a client in Silverlight that will show a lot of TIFF images. Silverlight natively do not support TIFF. I need a control/class to convert tiff to jpg in runtime inside the Silverlight client. Any idea?
In Silverlight forum last friday I received this post:
Re: How to Convert TIFF to JPG Inside Silverlight, client side, using a control or a class/function?
12-18-2009 5:38 PM |
If you're willing to use a third-party library, check out ImageGear for Silverlight provided by Accusoft Pegasus. It's a 100% managed Silverlight toolkit (http://www.accusoft.com/ig-silverlight.htm), and runs entirely on the client. TIFF support is included (among lots of other formats).
Hope this helps,
Casey
I was successful displaying TIFFs in Silverlight. It's easy to port the free LibTiff.NET library to Silverlight, just 3-4 minor tweaks required.
The library itself is quite legacy-like and raw to use and one still needs to have some knowledge about the inner workings of the TIFF format in order to be able to extract the image data the way one needs it.
But it's doable and the bits and pieces can then be chiseled into a WriteableBitmap.
Not sure you are interested in solution by now, but we've just released LibTiff.Net 2.0 with Silverlight support, improved documentation and samples.
There is Silverlight Test Application in source package that shows how to create WriteableBitmap from TIFF images in Silverlight. Maybe it will help you or others.

Resources