Main Site Documentation

Error while trying to save camera captured pic on hard drive


#1

Hi , I am trying to save an image captured by camera using following code :

       void camera_PictureCaptured(GTM.GHIElectronics.Camera sender, GT.Picture picture)
        {
            canvasCamera.Children.Remove(cameraImage);
            canvasCamera.UpdateLayout();

            cameraImage = new Image(picture.MakeBitmap());
            cameraImage.Width = 100;
            cameraImage.Height = 100;
            canvasCamera.Children.Add(cameraImage);
            Canvas.SetTop(cameraImage, 70);
            Canvas.SetLeft(cameraImage, 30);

            writeFile(@ "\TESTFILE.bmp", cameraImage.Bitmap.GetBitmap());

        }

private static void writeFile(string path, byte[] data)
        {
            // Create a file stream object
            FileStream fHandle = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write);
            // Write the contents
            fHandle.Write(data, 0, data.Length);
            // We're done.
            fHandle.Close();
        }

but I get the following error :

The thread '<No Name>' (0x3) has exited with code 0 (0x0).
    #### Exception System.IO.IOException - CLR_E_VOLUME_NOT_FOUND (1) ####
    #### Message: 
    #### System.IO.Path::NormalizePath [IP: 0070] ####
    #### System.IO.Path::GetFullPath [IP: 001a] ####
    #### System.IO.FileStream::.ctor [IP: 0009] ####
    #### System.IO.FileStream::.ctor [IP: 0009] ####
    #### AllControls.Program::writeFile [IP: 0007] ####
    #### AllControls.Program::camera_PictureCaptured [IP: 006a] ####
    #### Gadgeteer.Modules.GHIElectronics.Camera::OnPictureCapturedEvent [IP: 0037] ####
    #### System.Reflection.MethodBase::Invoke [IP: 0000] ####
    #### Gadgeteer.Program::DoOperation [IP: 001a] ####
    #### Microsoft.SPOT.Dispatcher::PushFrameImpl [IP: 0054] ####
    #### Microsoft.SPOT.Dispatcher::PushFrame [IP: 001a] ####
    #### Microsoft.SPOT.Dispatcher::Run [IP: 0006] ####
    #### Gadgeteer.Program::Run [IP: 0020] ####
A first chance exception of type 'System.IO.IOException' occurred in System.IO.dll
Error invoking method "Gadgeteer.Modules.GHIElectronics.Camera" (check arguments to Program.BeginInvoke are correct)


#2

How are you mounting the filesystem?

The error CLR_E_VOLUME_NOT_FOUND usually means the file system is not yet mounted.

I am not familiar with the hardware you are using, but I use the following with Cobra 2.


    ps = new PersistentStorage("SD");
    ps.MountFileSystem();


#3

@ Dave McLaughlin -

I want to save the file on my computer hard drive , not on SD card !
Am I doing the right thing ?


#4

@ andre.m -

I am using FEZ Spider mainboard , and It supports USB Client


#5

@ andre.m -

thnx , but the link is currapt