Question Microsoft LifeCam libraries

maxhertz

Member
Joined
Jul 21, 2011
Messages
8
Programming Experience
10+
Anyone had any experience of using the MS LifeCam .net webcam libraries/API or know where to find any documentation?
I have just bought a LifeCam Cinema webcam and noticed that there are a whole bunch of .net libraries in the application folder:

Microsoft.LifeCam.Application.dll
Microsoft.LifeCam.Camera.dll
Microsoft.LifeCam.Controllers.dll
Microsoft.LifeCam.Framework.dll
Microsoft.LifeCam.FxMgr.dll
Microsoft.LifeCam.Interfaces.dll
Microsoft.LifeCam.Interop.dll
Microsoft.LifeCam.Logging.Core.dll
Microsoft.LifeCam.Logging.dll
Microsoft.LifeCam.PubMgr.dll
Microsoft.LifeCam.Streamer.dll
Microsoft.LifeCam.Views.dll
Microsoft.LifeCam.Webcam.dll

They seem to be for .net 3.5, using WPF.
The Microsoft.LifeCam.Streamer library provides a WPF control called PreviewView which seems to provide a live view of the output from the camera, although I have not managed to get it to work.

It can be seen by using something like:

HTML:
<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="512" Width="1073"
    xmlns:strm="clr-namespace:Microsoft.LifeCam;assembly=Microsoft.LifeCam.Streamer">
    <strm:PreviewView Name="prev1" />
</Window>

It would seem that it needs to be initialised using the Streamer class, passing a reference to the PreviewView.

The application that I would like to use them for is to occasionally save the last two minutes of video, to a wmv file, in a similar way to the provided LifeCam application does.

thanks

John
 
Last edited:
OK, some progress.

I have managed to get the Previw to work, and have been able to select the resolution of the camera, something I haven't been able to do using other APIs.

vb code for the above Window (with two buttons added):

VB.NET:
Imports Microsoft.LifeCam
Imports System.Runtime.InteropServices.ComTypes
Class MainWindow
    Private p As Streamer
    Private Const DesiredVideoWidth As Integer = 800
    Private Const DesiredVideoHeight As Integer = 448
    Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
        Dim x As New Microsoft.LifeCam.CameraList
        Dim cam As Camera = x(0)
        p = New Streamer(cam.VideoMoniker, cam.MicrophoneMoniker, prev1, False)
        For i As Integer = 0 To p.VideoResolutions.Count - 1
            If p.VideoResolutions(i).Width = DesiredVideoWidth And p.VideoResolutions(i).Height = DesiredVideoHeight Then
                p.CurrentVideoResolutionIndex = i
            End If
        Next
        p.Start()
    End Sub
    Private Sub Button2_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button2.Click
        p.Stop()
        p.Dispose()
    End Sub
End Class
 
Last edited:
and if you want to capture the video to a file (Windows Media Video 9, 15 fps), then replace p.Start() with:

Dim cinf AsNewCaptureInfo("c:\test.wmv", Interfaces.MediaType.AudioVideo)
p.StartCapture(cinf)
 
Last edited:
Below is what I have done so far to get the Lifecam functional (and failed).
I get the error "No symbols are loaded for any call stack frame. The source code cannot be displayed". Followed by the debug report saying BadImageFormatException was unhandled with "Could not load file or assembly 'Microsoft.LifeCam.Camera or one of its dependencies. An attempt was made to load a program with an incorrect format.

I want a picture from the webcam so I can track movement in frame but it does not load to a picturebox or anything it just creates errors. Any help?

Declare prev1 as PreviewView
Add the references below
  1. Microsoft.LifeCam.Application.dll
  2. Microsoft.LifeCam.Camera.dll
  3. Microsoft.LifeCam.Controllers.dll
  4. Microsoft.LifeCam.Framework.dll
  5. Microsoft.LifeCam.FxMgr.dll
  6. Microsoft.LifeCam.Interfaces.dll
  7. Microsoft.LifeCam.Interop.dll
  8. Microsoft.LifeCam.Logging.Core.dll
  9. Microsoft.LifeCam.Logging.dll
  10. Microsoft.LifeCam.PubMgr.dll
  11. Microsoft.LifeCam.Streamer.dll
  12. Microsoft.LifeCam.Views.dll
  13. Microsoft.LifeCam.Webcam.dll
  14. PresentationCore
  15. WindowsBase
  16. PresentationFramework
 
Are you sure you created the Project as a WPF Application, not a Windows Forms Application?
What version of Visual Studio are you using?
 
I have used both a Forms and a WPF application and still receive errors.
The Forms application has the error listed above.
The WPF says the streamer assembly is not found.

I am using 3.5 as it says in my bar. The only reason I want this is to get higher resolution from the camera as avicap32 works fine for my full project (motion tracking).
 
I have just now tried creating a new WPF .net 3.5 project.
The only references I added were to Streamer and Interfaces (using Browse to C:\Program Files\Microsoft LifeCam\)
and just one line in the Loaded event:
Dim prev1 As New Microsoft.LifeCam.PreviewView

Ran with no errors.
 
Last edited:
Sorry to bump an old topic.

Is there any way you can provide me with the libraries you have?
I am currently trying to work with a LifeCam Studio HD camera and it doesn't seem to have the libraries you mentioned, yet it runs off the same software.

Thanks,
MrZ
 
There is a link above to the LifeCam 3.6 download page.

Here it is again:

Software Downloads: LifeCam Cinema

The libraries are installed in C:\Program Files\Microsoft LifeCam

Ahh!
I found them.
My operating system is 64-bit.
There were some files in C:\Program Files\Microsoft LifeCam\
But the dll's were hiding in C:\Program Files (x86)\Microsoft LifeCam\

Thank you!
 
Hi maxhertz


I have one problem, i have lifecam hd 5000 and implement your solutions (dll lifecam in my app WPF) its great work. But i need flip horizontal in preview and but not work.

attempt to use

XMLS
<strm:previewView Name="prev1">
<strm.RenderTransform>
ScaleX="-1" <ScaleTransform ScaleY="1"/>
</ strm.RenderTransform>
</ strm: PreviewView>

C #
prev1.RenderTransformOrigin = new Point (0.5, 0.5);
ScaleTransform ScaleTransform flipTrans = new ();
flipTrans.ScaleX = -1;
flipTrans.ScaleY = 1;
prev1.RenderTransform = flipTrans;

but does not in any way.
Please help me


BlackCrash!
 
Hi John,
I've completed a test application following information provided by you in "Microsoft LifeCam libraries". This is the environment of my application:
OS: Windows XP
LifeCam version: 3.22.270
Camera: VX 6000
Max resolution: 5MP (photo capture, video capture disabled)
Other resolutions: 160x120, 320x240, 640,480, 800x600 (photo and video capture) and 1.3MP (photo capture, video capture disabled)

My test application allow capture video and frames only if I set resolution to 640x480. If I try to set any other resolution I get the error 0x80040217. My goal is capture periodically 5MP pictures. I already tried it with VIDCAP but I have the same problem with resolution. Could you give me any idea?

Thanks in advance
Livi
 
Hi Livi,

I have been able to capture videos by creating a WPF application based on the steps given earlier in this post thread, however I only require a photo and the method I am using is giving an error:

My application environment:
OS: Windows 7 64Bit
LifeCam version:
Camera VX 2000.

I am getting an the below exception:

System.ArgumentException was caught
Message=info
Source=Microsoft.LifeCam.Streamer
StackTrace:
at Microsoft.LifeCam.Streamer.StartCapture(ICaptureInfo info)
at WpfLifeCam.MainWindow.BtnCapture_Click(Object sender, RoutedEventArgs e) in C:\Users\Administrator\Documents\Visual Studio 2008\Projects\MyFingerTest\WpfLifeCam\MainWindow.xaml.cs:line 78


Below are the exerpts from my code in handler BtnCapture_Click:

try
{
CameraList x = new CameraList();
if (x.Count < 1)
{
MessageBox.Show("No webcam device found!", "Registration App", MessageBoxButton.OK, MessageBoxImage.Exclamation);
return;
}
Camera cam = (Camera)x[0];
p = new Streamer(cam, prev1, false);
p.CurrentVideoResolutionIndex = 1; //selecting a resolution.
p.Start();


CaptureInfo cap_info = new CaptureInfo(commonAppFolder + "\\Ms_lifecam_pic.jpg", Microsoft.LifeCam.Interfaces.MediaType.Photo);
p.StartCapture(cap_info);
p.StopCapture();

}
catch (Exception ex)
{
MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace);
}


Please help!
 
kayzee_NET, this is a VB.Net forum.
 
Back
Top