Windows Mobile: using phone's camera with C#

馋奶兔 提交于 2019-12-03 07:42:11

问题


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:


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;
    }

Later Edit: Some of you might find useful this link, too: http://community.intermec.com/t5/General-Development-Developer/CN50-MS-Camera-Capture-Dialog-generates-error/m-p/12881#M4083




回答2:


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.




回答3:


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.




回答4:


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



来源:https://stackoverflow.com/questions/1082625/windows-mobile-using-phones-camera-with-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!