Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

7.imaging on windows phone


Published on

Published in: Technology, Art & Photos
  • Be the first to comment

  • Be the first to like this

7.imaging on windows phone

  1. 1. Imaging on Windows Phone Nguyen Pham Nokia Developer Champion
  2. 2. Windows Phone 8 – Imaging on Windows Phone • Lenses • Nokia Imaging SDK • Windows Phone Photo Extensibility Microsoft confidential
  3. 3. Lenses 3 Microsoft confidential 11/5/2013
  4. 4. Creating a Lens • A Lens is a custom camera application which can be accessed from within the camera application • An application is flagged as a Lens application by setting a flag in the manifest and providing icons that can be used to browse for the Lens when the camera is in use • I’ve created a Imagine Cam lens application which I have registered in this way
  5. 5. Creating a Lens application <Extensions> <Extension ExtensionName="Camera_Capture_App" ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5631}" TaskID="_default" /> </Extensions> • This text must be added to the WMAppManifest.xml file for the application, just after the <Tokens> section • There is no GUI for this alteration, you have to edit the XML directly
  6. 6. Adding the Lens Icons • Three Icons are required, one for each Windows Phone screen size • WVGA 173 × 173 AssetsLens.Screen-WVGA.png • 720p 259 × 259 AssetsLens.Screen-720p.png • WXGA 277 × 277 AssetsLens.Screen-WXGA.png • They are all placed in the Assets folder of the application • Use a transparent background to match the Windows Phone color scheme
  7. 7. Creating an Auto-Uploader for photos <Extensions> <Extension ExtensionName="Photos_Auto_Upload" ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5632}" TaskID="_default" /> </Extensions> • You can also create an application that has an auto-upload behaviour for pictures that the user may take • The upload behaviour is a “resource intensive” background task • The application must set the extension shown above and display a settings page where the user can set authentication and upload options • This is a background process and therefore might not get to run
  8. 8. Create Rich Media Editing <Extensions> <Extension ExtensionName="Photos_Rich_Media_Edit" ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5632}" TaskID="_default" /> </Extensions> The navigation URI looks just as you would expect: /MainPage.xaml?Action=RichMediaEdit&token={2fad1162-7f85-4d6c-bbd6aee6f10e501d} 8 Microsoft confidential 11/5/2013
  9. 9. Other Extensions <Extensions> <Extension ExtensionName="Photos_Extra_Hub" ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5632}" TaskID="_default" /> <Extension ExtensionName="Photos_Extra_Share" ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5632}" TaskID="_default" /> <Extension ExtensionName="Photos_Extra_Image_Editor" ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5632}" TaskID="_default" /> </Extensions> 9 Microsoft confidential 11/5/2013
  10. 10. Override UriMapper class UriMapper : UriMapperBase { public override Uri MapUri(Uri uri) { Uri mappedUri = uri; string url = uri.ToString(); if (url.Contains("ViewfinderLaunch")) { mappedUri = new Uri("/Pages/CamPage.xaml", UriKind.Relative); } else if (url.Contains("RichMediaEdit") || url.Contains("ShareContent") || url.Contains("EditPhotoContent")) { string photoUrl = url.Replace("CamPage", "PhotoPage").Replace("FileId", "token"); mappedUri = new Uri(photoUrl, UriKind.Relative); } return mappedUri; } } Code in contructor of app class: RootFrame.UriMapper = new Helpers.UriMapper(); 10 Microsoft confidential 11/5/2013
  11. 11. 11 Microsoft confidential 11/5/2013
  12. 12. Nokia Imaging SDK 12 Microsoft confidential 11/5/2013
  13. 13. Nokia Imaging SDK • Early Beta version, makes some of the technologies that Nokia uses in its own imaging applications available to developers • Provides more than 50 pre-made filters and effects that have been specifically developed for mobile imaging, with speed and memory performance as key drivers • The SDK is super-fast, meticulous memory and code optimization • Allows access to any image data without decoding the whole image • Apply effects to high resolution images, without worrying about memory budget
  14. 14. Easy to use • Add a filter to your existing project with just a few lines of C#. • Support to be called from C++ code. • The filters can be chained to create more effects
  15. 15. List Of Filter and Effect I
  16. 16. List Of Filter and Effect II
  17. 17. List Of Filter and Effect III
  18. 18. Core concepts • Provided as a Windows Phone Runtime library • One of the key benefits of this is that developers can call the methods of the library from C#, Visual Basic, or C++. Step 1: Include Nokia Imaging SDK Libraries into your Project Step 2 : Create EditingSession Step 3 : Create and add filters to EditingSession Step 4 : Use asynchronous methods RenderToImageAsync or RenderToJpegAsync to produce the final processed image
  19. 19. The libraries • Before starting to use the functionality provided by the Nokia Imaging SDK, the SDK libraries must be added to the project. • Two ways to add the libraries are proposed: • Using the Visual Studio NuGet package manager • Adding references to the project. For detailed instructions
  20. 20. The libraries (Cont.)
  21. 21. Create EditingSession • Create an Imaging SDK EditingSession using a compressed or uncompressed image: • From a Stream (from PhotoChooserTask): EditingSession session = await CreateEditingSessionAsync(stream); • From a JPEG in a IBuffer: EditingSession session = new EditingSession(jpegData); • From a WriteableBitmap: EditingSession session = new EditingSession(sourceBitmap);
  22. 22. Create and add filters and effects • Use FilterFactory to create filters and effects • Use EditingSession methods to add filters and effects: session.AddFilter(FilterFactory.CreateCartoonFilter(true)); session.AddFilter(FilterFactory.CreateFogFilter()); • You can also use FilterGroup to add several filters and effects in one call
  23. 23. Produce final processed image • You can render the processed image to: • A XAML Image control: await session.RenderToImageAsync(FilteredImage); • A WriteableBitmap : await session.RenderToWriteableBitmapAsync(FilteredBitmap); • An IBuffer : IBuffer jpegOut = await session.RenderToJpegAsync(); 23 11/5/2013
  24. 24. Editing-session code using Nokia.Graphics.Imaging; using (EditingSession editsession = new EditingSession(inputBuffer)) { // First add an antique effect editsession.AddFilter( FilterFactory.CreateAntiqueFilter()); // Then rotate the image editsession.AddFilter( FilterFactory.CreateFreeRotationFilter(35.0f, RotationScaleMode.FitInside)); // Add more filters here if you want... // Finally, execute the filtering and render to a bitmap await editsession.RenderToBitmapAsync(outputBuffer); }
  25. 25. License Contains functionality provided by the Nokia Imaging SDK. Copyright © 2013 Nokia Corporation All rights reserved. 25 11/5/2013
  26. 26. Demo 26 Microsoft confidential 11/5/2013
  27. 27. Nokia Project sample Filter Effects Real-time Filter Filter Explorer
  28. 28. Imagine Cam 28 Microsoft confidential 11/5/2013 Imagine Cam
  29. 29. Imagine Cam 29 11/5/2013
  30. 30. Resource • You found an error in the SDK, have suggestions, need help? • Nokia Imaging discussion board: • You have developped an app with the SDK? • We’d love to hear about it. Tell us by sending a mail at • Documentation and code samples • Imaging in the Lumia Developer’s Library: • Nokia Imaging SDK:
  31. 31. • Windows Phone 7.5 Training Kit : us/download/details.aspx?id=28564 • Windows Phone 8 Training kit:
  32. 32. The information herein is for informational purposes only an represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.