Friday, April 4, 2014

Content for the Modern Camera and Imaging Apps Build 2014 Session

I had a chance to give a presentation at Microsoft's largest developer conference //build 2014 about the great new capturing APIs. The session Modern Camera and Imaging Apps was given together with Jeff Day who's the Windows Camera API lead PM.

The session was recorded and available at Channel 9.

The slides can also be viewed / downloaded here.
The source code of the demos is available here.


  1. [Duplicate of my comment on the build site]
    Great presentation. I am developing a simple camera app for the 520 and I'm excited about the new Windows.Media.Capture namespace. I want to show the user a live preview, but I want to draw a circle on the screen that has a specific field of view (say, 12 degrees). Then they can put the subject directly in the circle.

    I believe WriteableBitmapEx will get me the circle I want, but I don't know how big to make it. Seems like I'd have to know the field of view of the lens and work from there.

    Do you know of any resources that might help with this? I've tried the forums, but the search capabilities aren't the best. Short of trial and error trigonometry, I wondered if there was a better way to do this.

    Thanks in advance. I'm also a big fan of MVVM Light. I understand Laurent works at IdentityMine, too. Must be a good company to have both of you guys.

    1. Not sure I get your idea / scenario. Can you elaborate on this?

    2. Thanks for responding. In my app, I want to show the user the live preview or viewfinder view. To help them compose the photo, I'd like to put a semi transparent circle in the center - kind of like the old school 35mm viewfinders.

      The key for me is that the circle is a fixed field of view angle. In my case, I want this to be 12 degrees. Other than trial and error and trigonometry (not my strong point :) ) I was trying to figure out if there was a way to get the field of view of the camera in normal mode and then, based on that and my 12 degree field of view requirement, determine just how big to make the circle on the viewfinder.

      Is that any better? I can imagine what I want, but I'm not sure if I know enough of the terminology to even state the question properly. Thanks in advance...

    3. You can use the Focal Length of the camera to compute the field of view like so:

      You can probably find out the focal length of the camera using the DeviceInformation.Properties of the relevant devices: DeviceInformation.FindAllAsync(DeviceClass.VideoCapture)

    4. Awesome, I'll check it out. Thanks very much!

    5. hi,

      When ever I ran the app on my phone, the video feed I am getting is from the front facing camera. How do I get the video feed from the main camera?

    6. It's a bit different with the new API. You need to check the DeviceInformation, get the right device for with the matching panel info and then initialize the MediaCapture with its ID.

      var cameraDeviceInfos = (await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture)).Where(d => d.IsEnabled && d.EnclosureLocation != null);

      var frontCamDeviceInfo = cameraDeviceInfos.FirstOrDefault(d => d.EnclosureLocation.Panel == Panel.Front);

      await mediaCapture.InitializeAsync(new MediaCaptureInitializationSettings
      PhotoCaptureSource = PhotoCaptureSource.Auto,
      AudioDeviceId = string.Empty,
      VideoDeviceId = frontCamDeviceInfo.Id

    7. Hi , I have changed the panel to Back and if I take picture the clarity of image is not so good . I tried focus & exposure setting , but there is no change in image.
      code as follows
      await mediaCapture.InitializeAsync(settings);
      var focusSettings = new FocusSettings();
      focusSettings.AutoFocusRange = AutoFocusRange.FullRange;
      focusSettings.Mode = FocusMode.Auto;
      focusSettings.WaitForFocus = true;
      focusSettings.DisableDriverFallback = false;

      await mediaCapture.VideoDeviceController.ExposureControl.SetAutoAsync(true);

  2. Hello,

    I am developing album application in windows phone 8.1 store application , where user creates album and chooes images from gallery
    for this i am using FileOpenPicker , but when i chooes more than 10 images application get crashed .
    Please help me for this

    Thank You

  3. Hello Rene, and thanks for your demos and examples. They have been great help. I am trying to write a WinPhone 8.1 or Win10 Mobile app that gets the stream from the camera, but then sends it to a server or something similar. Maybe using sockets? I can't figure out how to send the stream or how to get it back on the server (ideally I should record the video on the server directly). From your examples I can tell that you can save the stream to a file and then upload the file, but I need more of a real time solution like an ip Webcam or a videochat app. I can't find any good examples of that, or pointers on how to to it. I am sorry to bother you with this, but do you know any sources I could investigate? Articles, demos, whatever help you could point me to would be of amazing help.

    Thanks again!!!

    1. The Win 8.1 WinRT MediaCapture quickly reaches its limitations with the built-in functions. I'm afraid you will have to create your own Media Foundation IMFSinkWriter or similar.