Select to view content in your preferred language

CameraService.DefaultCamera.GetCurrentImage() falls over

608
2
05-14-2013 09:02 PM
VishApte
Esri Contributor
Hi all,

I am having a little problem with a custom camera page I am having to develop in ArcGIS for Windows Mobile. The reason for custom camera page is, out of the box ArcGIS for Windows Mobile 10.1.1 does not provide user with option to chage camera resolution settings.

In the code I am using following lines;

ESRI.ArcGIS.Mobile.Client.WebCam.CameraService.DefaultCamera.CaptureHeight = 768;
ESRI.ArcGIS.Mobile.Client.WebCam.CameraService.DefaultCamera.CaptureWidth = 1024;
System.Drawing.Bitmap image = ESRI.ArcGIS.Mobile.Client.WebCam.CameraService.DefaultCamera.GetCurrentImage();
image.Save(System.IO.Path.GetTempFileName(), image.RawFormat);

However, the code above falls over with MemoryAccessViolation, a very low level error. Even Try Catch does not seem to capture it. In debug mode, error sometimes happens at GetCurrentImage, sometimes at image.Save and sometimes after.

I have tried all sorts of things, such as cloning Bitmap, saving it MemoryStream first and then saving to FileStream, adding Thread.Sleep, boxing the disposable objects with "using" etc. But one of the calls that involve Bitmap or Stream objects, falls over with AccessViolation. Any idea why this is happening.

Out of the box Camera button works fine and I can see JPG created in %TEMP% folder as well as attachment added. Just they are very low resolution images.

Any help is much appreciated. My project goes live in two weeks time.

Cheers,
Vish

PS: Someone else had started a similar thread but no answer was provided.
0 Kudos
2 Replies
by Anonymous User
Not applicable
What are the specs of the device you are using?
0 Kudos
VishApte
Esri Contributor
What are the specs of the device you are using?

Client is using HP Elitepad 900 model with Windows 8. The device has inbuilt 8mp camera with flash. HP's camera metro app can take brilliant photos, ArcGIS Mobile is stuck at 640x480 without flash.

Cheers,
Vish
0 Kudos