Programmatically controlling the camera
21 Jan 2013
There are several methods in the Microsoft Windows Embedded Handheld (formerly Windows Mobile) operating system to programmatically control the built-in camera. The following web pages describe some of the various methods, in order of recommendation highest (top) to least (bottom).
- http://msdn.microsoft.com/en-us/library/microsoft.windowsmobile.forms.cameracapturedialog.aspx
- http://msdn.microsoft.com/en-us/library/bb160743.aspx
- http://msdn.microsoft.com/en-us/library/aa928779.aspx
Official sample code from Microsoft is provided at the following web page and sub-links.
The resolution of the built-in camera on some of our newer rugged handheld computer products may cause "out of memory" issues when trying to programmatically capture camera images. Information in regards to the cause of such an issue as well as the best methods to work around the issue are described in the following article.
Program memory (RAM) limitations and management
Using the OpenNETCF SDF image functions has been known to at least allow 1600 x 1200 image captures without encountering out of memory errors.
Another method to work around such an issue is to reduce the resolution of the images being captured. Refer to the following Windows registry key settings for how this could be done.
[HKEY_LOCAL_MACHINE\Software\Microsoft\Pictures\Camera\OEM\PictureResolution]"OptionNum"=dword:5***This would be how you would tell what the max resolution is. It is zero-indexed so (OptionNum – 1) is max for the “Resolution” value.
RegistryKey rKey = Registry.CurrentUser;rKey = rKey.OpenSubKey("Software\\Microsoft\\Pictures\\Camera\\User", true);rKey.SetValue("Resolution", 1);rKey.SetValue("QualitySetting", 0);rKey.Close()
Additional ideas and information may be provided at the following web pages.
- Disabling the built in camera
- http://support.developer.motorola.com/app/answers/detail/a_id/489
- http://community.psion.com/knowledge/w/knowledgebase/cameracapturedialog-and-shcameracapture-memory-issues-and-how-to-avoid-them.aspx
Alternative camera options for use with our rugged handheld computers are listed at this web page.