Take a picture in WPF using the default camera app in Windows 8

I was asked to develop software at vb.net and one of its functions should be the ability to take photos on a tablet pc. I've already played around with the MediaCapture API which returns a photo to me, but it doesn't seem to be possible to show a preview or anything outside of ModernUI apps. It's just pure photography.

I thought a bit how this problem could be solved. Then I got some inspiration from my Android phone. My idea was to call some kind of API to open a normal Windows 8 camera app in ModernUI mode, let the user take a picture, and then get it with a "return value" like it's usually done in Android apps.

Now my question is, if there is a way to start the default windows 8 camera app, let it take a picture and get it back into my WPF desktop app.

I could develop my software as a ModernUI application, but I never did, and you also feel like you should publish it via a web store, but I only want to use it internally within my company.

My other (simple silly) idea would be to ask the user to open the camera app on their own, take some pictures, and then return to my software later. I could get the images from the folder where they were saved. I think this will work too, but I don't really like this idea because it is not very intuitive and just seems stupid.

If you have an idea (or alternative) I would be very happy if you could share it with me.

Thanks in advance!

+3


source to share


1 answer


Unfortunately, there are no .NET classes that allow you to access the webcam or built-in camera on your computer. This means you have to take a look at the native Windows API and call it from your application. I cannot point you to the correct methods that you should use as I just used Microsoft Media Foundation to capture a continuous stream of images from a webcam and encode it into a video file.

There are some sites out there that encapsulate this native functionality in .NET classes, but I don't know if they're good or not:



In Windows Store apps, this task can be accomplished relatively easily using the media capture API you mentioned. You can also download Windows Store apps if you have Windows 8 Pro or Enterprise - then you don't need to publish your app to the Windows Store.

If you have further questions, please do not hesitate to ask.

+2


source







All Articles