Coder Social home page Coder Social logo

microsoft / photo-inspector Goto Github PK

View Code? Open in Web Editor NEW
25.0 73.0 17.0 21.87 MB

Photo Inspector is an example application on how to capture and process high resolution photos (resolution depends on device hardware).

License: Other

C# 100.00%

photo-inspector's Introduction

Photo Inspector

Photo Inspector is an example application on how to capture and process high resolution photos (resolution depends on device hardware).

Capture a photo and slide your finger on the preview to bring up a loupe to zoom right into pixel perfect details in the photo. Save a lower resolution copy of the photo to the main Photos gallery while retaining the original maximum resolution photo for later use. Share photos as lower resolution copies to online services like Facebook and Twitter.

The example has been developed with Silverlight for Windows Phone devices and tested to work on Lumia devices with Windows Phone 8.1.

This example application is hosted in GitHub: https://github.com/Microsoft/photo-inspector

For more information on implementation, visit Lumia Developer's Library: http://developer.nokia.com/resources/library/Lumia/imaging/working-with-high-resolution-photos/photo-inspector.html

  1. Usage

This is a simple build-and-run solution. See section 5 for instructions on how to run the application on your Windows Phone 8.1 device.

  1. Prerequisites

  • C# basics
  • Windows 8.1
  • Microsoft Visual Studio Express for Windows Phone 2013
  1. Project structure and implementation

3.1 Folders

The root folder contains folders for Silverlight 8.1 and Silverlight 8.0 versions of the application, the license information and this file.

Folders for both versions of the application contain:

  • MagnifierApp: Root folder for the implementation files.
  • Assets: Graphic assets like icons and tiles.
  • Pages: Phone application pages.
  • Models: Photo load and save model.
  • Properties: Application property files.
  • Resources: Application resources.
  • Utilities: Utility classes.

3.2 Important files and classes

File Description
Models/PhotoModel.cs Saving and loading photos, current photo tombstoning, storage handling.
Pages/ViewfinderPage.xaml(.cs) Simple viewfinder for capturing photos.
Pages/MagnifierPage.xaml(.cs) Photo preview and touch-to-zoom photo detail inspection loupe.
Pages/PhotosPage.xaml(.cs) Shows photos available for magnifying and re-framing.
Pages/CropPage.xaml(.cs) Allows user to crop the photo. Pan & pinch zoom functionality.
Pages/InfoPage.xaml(.cs) Displays selected EXIF records for current photo.
  1. Compatibility

Application works on Windows Phone 8.1. A separate version exists for Windows Phone 8.0.

Tested to work on Nokia Lumia 1520 and Nokia Lumia 630

Developed with Microsoft Visual Studio Express for Windows Phone 2013.

4.2 Known Issues

None.

  1. Building, installing, and running the application

5.1 Preparations

Make sure you have the following installed:

  • Windows 8.1
  • Windows Phone SDK 8.1

5.2 Using the WINDOWS PHONE 8 SDK

  1. Open the SLN file: File > Open Project, select the file MagnifierApp.sln
  2. Select the target 'Device' and 'ARM'.
  3. Press F5 to build the project and run it on the device.

5.3 Deploying to Windows Phone 8

Please see official documentation for deploying and testing applications on Windows Phone devices: http://msdn.microsoft.com/library/windowsphone/develop/ff402565(v=vs.105).aspx

  1. License

See the license text file delivered with this project: https://github.com/Microsoft/photo-inspector/blob/master/License.txt

  1. Related documentation

See http://developer.nokia.com/resources/library/Lumia/imaging/working-with-high-resolution-photos/photo-inspector.html for more information on the project.

See http://developer.nokia.com/resources/library/Lumia/imaging/working-with-high-resolution-photos.html for information on how to capture and handle high resolution photos for example on Nokia Lumia 1020.

  1. Version history

  • 2.0: Project converted to Silverlight 8.1

    • High resolution photos are saved to Camera Roll instead of local storage
    • Photo grid shows all photos from Camera Roll
    • Updated to the latest Nokia Imaging SDK version 1.2.151
  • 1.3: Fourth public release of Photo Inspector

    • Updated to the latest Nokia Imaging SDK version 1.1.177
  • 1.2: Third public release of Photo Inspector

    • Updated to the latest Nokia Imaging SDK
    • Now using Nuget Package Restore for external libraries
  • 1.1: Second public release of Photo Inspector

    • Photos can be cropped, and it's possible to either change the framing again or to revert to the original uncropped photo
    • New photo information page for displaying EXIF information
    • Locally saved photos are displayed on all devices, not just high camera resolution devices
    • Camera and locally saved photos can be accessed from the magnification page
    • Fixed issue where pressing the camera HW button did not capture an image if camera was focusing at the same time
    • Locally saved photos page shows a "reframed" indicator on photos that are crops
    • Also included are a number of other minor changes
  • 1.0: First public release of Photo Inspector

photo-inspector's People

Contributors

mikpiipp avatar mustanaamio avatar shyofutu avatar shyoty avatar tompaana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

photo-inspector's Issues

Potential Deadlock

The code in the InitializeCamera method in
photo-inspector/PhotoInspectorWP80/MagnifierApp/Pages/ViewfinderPage.xaml.cs waits synchronously on Task -- this code is reachable from an OnNavigatedTo handler, suggesting that it runs on the UI thread.
Here is the code in question:

var task = PhotoCaptureDevice.OpenAsync(SENSOR_LOCATION, captureResolution).AsTask();
task.Wait();

Blocking the UI thread using the Wait() method can result in deadlock, if the code also
employs (asynchronous) await statements. The reason is that continuations following awaits
are posted to the UI thread - if the UI thread is blocked, these will never run. If the task blocking
the UI thread depends on these continuations to run in order to unblock it, the code deadlocks.
Please refer to http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115163.aspx for a more
detailed discussion.

A possible fix is to offload the asynchronous operations to a non-UI thread, using the Task.Run
API call documented here: https://msdn.microsoft.com/en-us/library/system.threading.tasks.task.run(v=vs.110).aspx
Stephen Toub discusses this refactoring (and other possible refactorings) here: http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx

I noticed that other code in this project that uses the synchronous wait call does so by
wrapping the task in Task.Run(), for example

photo-inspector\PhotoInspectorWP80\MagnifierApp\Pages\MagnifierPage.xaml.cs(306):Task.Run(async () => { _info = await _source.GetInfoAsync(); }).Wait();

Perhaps you missed this call site in InitializeCamera?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.