views:

3394

answers:

5

Hello!

I want to show the image that mobile phone's camera its taking on a control in a WinForm. The idea is that my application works like camera's program. I want to show the image like if the user is going to take a photo.

How can I do that? Can I do that?

If you need more details ask me.

Thank you!

+1  A: 

I think you should program against the hardware directly using a sdk or something similar.

Since programming against hardware directly is usually in c/c++ the sdk will probably be native. So either you probably have to use pinvoke and the unsafe keyword.

But first you should find the way to access the camera, and since this is hardware dependant you can start on the website of the phone's manufacturere.

Henri
+1  A: 

Check SmartDeviceFramework from OpenNetCF.org have some tools for PocketPC including capturing frames from Camera.

pho3nix
+2  A: 

What you want is a preview, not the capture, which is far more difficult. The best (and maybe only) solution is to insert a DShow Filter into the filtergraph to pipe the preview window to where you want.

COM is a bear in the Compact Framework, and DShow is tough no matter what platform you're on. There are some resources online, like the DShow.NET library at sourceforge, and Alex Mogurenko's blog, but nothing specific to creating a capture.

There is a native capture sample in the WinMo SDK that would be a useful guide to getting you there.

ctacke
Thank you for your answer. I haven't work with DShow. Is it compatible with all kind of Windows Mobile device? Where can I find more information about DShow?
VansFannel
Maybe it's something like that: http://www.codeproject.com/KB/mobile/samplegrabberfilter-wm6.aspx
VansFannel
I don't understand this:"...to insert a DShow Filter into the filtergraph to pipe the preview window to where you want."
VansFannel
+1  A: 

check Camera example from DirectShowNETCF

alex
+3  A: 

Not very sure what you need, but you may try using Microsoft.WindowsMobile.Forms.CameraCaptureDialog:

    string originalFileName;
    using (CameraCaptureDialog dlg = new CameraCaptureDialog()) {
        dlg.Mode = CameraCaptureMode.Still;
        dlg.StillQuality = CameraCaptureStillQuality.Low;
        //dlg.Resolution = new Size(800, 600);
        dlg.Title = "Take the picture";
        DialogResult res;
        try {
            res = dlg.ShowDialog();
        }
        catch (Exception ex) {
            Trace.WriteLine(ex);
            return null;
        }

        if (res != DialogResult.OK)
            return null;
        this.Refresh();
        originalFileName = pictureFileName = dlg.FileName;
    }
Adi
Great piece of code, Thanks!
d1k_is