views:

49

answers:

3

I'm writing an augmented reality app for Windows Phone 7 as a school project. I want to get the camera output and then add a layer of data over it. Is there a way to have the camera output displayed in a panel?

A: 

The short answer to your question is: no.

You can capture photos using the CameraCaptureTask provided by the Windows Phone 7 API (here), but, to the best of my knowledge, you cannot capture a live stream of data from the camera.

Microsoft has not announced whether this functionality will be augmented in a future release of the platform.

Example of using CameraCaptureTask:

public partial class MainPage : PhoneApplicationPage
{
   // Declare the CameraCaptureTask object with page scope.
   CameraCaptureTask cameraCaptureTask;

   // Constructor
   public MainPage()
   {
      InitializeComponent();

      // Initialize the CameraCaptureTask and assign the Completed handler in the page constructor.
      cameraCaptureTask = new CameraCaptureTask();
      cameraCaptureTask.Completed += new EventHandler<PhotoResult>(cameraCaptureTask_Completed);
   }

   // In this example, the CameraCaptureTask is shown in response to a button click.                
   private void button1_Click(object sender, RoutedEventArgs e)
   {
      cameraCaptureTask.Show();
   }
   // The Completed event handler. In this example, a new BitmapImage is created and
   // the source is set to the result stream from the CameraCaptureTask
   void cameraCaptureTask_Completed(object sender, PhotoResult e)
   {
      if (e.TaskResult == TaskResult.OK)
      {
         BitmapImage bmp = new BitmapImage();
         bmp.SetSource(e.ChosenPhoto);
         myImage.Source = bmp;
      }
   }
}
Ed Altorfer
+3  A: 

According to Microsoft's UI Design and Interaction Guide [PDF], They do not allow developers to access the camera with any UI Elements.

This comes from page 127:

There are no direct UI elements associated with the Camera, but developers have access to the Camera in the Microsoft.Phone.Tasks namespace.

Austyn Mahoney
A: 

As noted here, we're limited to CameraCaptureTask Functionality for the moment.

Information has been released recently to indicate functionality to support AR is on the roadmap.

Mick N