Main Site Documentation

Exception when using camera


#1

Hi,

I am using the Camera’s TakePicture() and StartStreamingBitmaps() methods for displaying and saving images from the camera. When used separately, they work fine. Hoever, if I call StartStreamingBitmaps() after I called TakePicture(), the following exception is thrown:


    #### Exception System.Exception - 0xffffffff (1) ####
    #### Message: 
    #### GHIElectronics.NETMF.USBHost.USBH_Webcam::StartStreaming_Internal [IP: 0000] ####
    #### GHIElectronics.NETMF.USBHost.USBH_Webcam::StartStreaming [IP: 0005] ####
    #### Gadgeteer.Modules.GHIElectronics.Camera::StartStreamingBitmaps [IP: 007e] ####
    #### //User code ####
An exception (first chance) of type "System.Exception" has occurred in GHIElectronics.NETMF.USBHost.dll

At this moment, the camera should not be busy, because the event handler of PictureCaptured has already been executed. I do not have a USBHostModule connected to the device. Only a SD card. If StartStreamingBitmaps() is called before the first call to TakePicture(), it succeeds.
After the exception, further calls to TakePicture() will crash, too. The following exception is thrown:


    #### Exception System.Exception - 0xffffffff (1) ####
    #### Message: 
    #### GHIElectronics.NETMF.USBHost.USBH_Webcam::StartStreaming_Internal [IP: 0000] ####
    #### GHIElectronics.NETMF.USBHost.USBH_Webcam::StartStreaming [IP: 0005] ####
    #### Gadgeteer.Modules.GHIElectronics.Camera::TakePicture [IP: 0054] ####
    #### //User Code (from timer event) ####
An exception (first chance) of type "System.Exception" has occurred in GHIElectronics.NETMF.USBHost.dll.

Both calls are executed from the same thread (the application’s main thread).
For clarification, here is a sequence of sample calls:


StartStreamingBitmaps - works
StopStreamingBitmaps - works
StartStreamingBitmaps - works
StopStreamingBitmaps - works
TakePicture - works
TakePicture - works
StartStreamingPictures - exception
StopStreamingPictures - works
TakePicture - exception

Is there anything to be paid attention to when using the two methods?

Nico


#2

Welcome to the forum.

Haven’t tried my camera module in awhile. Have to check that. Has anybody else seen this?


#3

I see this also…


#4

What firmware version? What device? Example software?


#5

Hi Gus,

sorry for the short message.

Hardware: Spider+T35
Firmware/Framework: newest

I have the same Problem like above.

Also this:
Code:


    public partial class Program
    {
        void ProgramStarted()
        {
            display_T35.WPFWindow.TouchDown += WPFWindow_TouchDown;
        }
        void WPFWindow_TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            throw new NotImplementedException();
        }
    }

When i run the code the display became a white background. When i touch one time all things works fine. I use 10 Spider-sets. The problems are on all systems. Allways with the newest Software/Firmware. I think in older Versions of Gadgeteer 4.2/MicroFramework 4.2 there where no problem with touch and camera events.

René


#6

@ dutzend - Hello. I modified your code slightly so it doesn’t exit with exception after the first touch. Every time the screen is touched I get the expected output “touch event”. Can you explain what behavior you expected from your program and what you see instead?

 public partial class Program
    {
        void ProgramStarted()
        {
            display_TE35.WPFWindow.TouchDown += WPFWindow_TouchDown;
        }
        void WPFWindow_TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            Debug.Print("touch event");
        }
    }

By the way, this topic should probably be on a separate thread/question in the forum.


#7

Hi Jeff,

the current behavior is, i must touch one time to see anything on the display…

Thx dutzend


#8

@ dutzend - In your actual code are you outputting something to the TE35 instead of throwing an exception? If so, can you post more of the code?


#9

With this code the program starts with a white screen. After a touch i see both texts. There are no exceptions.


    public partial class Program
    {
        Font _small = Resources.GetFont(Resources.FontResources.small);

        void ProgramStarted()
        {
            display_T35.SimpleGraphics.AutoRedraw = true;
            display_T35.WPFWindow.TouchDown += WPFWindow_TouchDown;
            display_T35.WPFWindow.Invalidate();

            display_T35.SimpleGraphics.DisplayText("XXX", _small, GT.Color.LightGray, 0, 0);
        }

        void WPFWindow_TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            display_T35.SimpleGraphics.DisplayText("YYY", _small, GT.Color.LightGray, 0, 20);
        }
    }


#10

@ dutzend - see https://www.ghielectronics.com/community/forum/topic?id=8998&page=1


#11

Thx Jeff, i use glide now!