Click here to Skip to main content
15,884,730 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
after sending the "take picture" command ,
How to get back the bytes that represent the image and store them in a memory stream ?
Posted
Comments
Pepin z Hane 10-Nov-12 16:49pm    
Which library do you use? takePicture is a method of which class of which library?
Kushina 12-Nov-12 11:16am    
thank you ( Pepin z Hane) for your useful reply , this camera has its own commands and this is the manual http://www.mediafire.com/view/?ec79xt02620zil5[^] I dont know at the moment if the code you mentioned in your reply can be applied to this camera because i have not got the camera with me now .

we are trying now to write 2 functions ::

1- TakePicture
2- ReadJpegFileContents

we are finding difficulties in writting the 2 functions because we are a beginners
in c# and we didnt study it in our course .

we will upload the code that we wrote later on !! .

we will appreciate any help in this feild or any references that might help

thank you

1 solution

I don't know what library do you use and even I don't know what linksprite camera means, but try this framework for working with cameras or video cameras: http://www.aforgenet.com/framework/[^]

I was working with video cameras, try this:
C#
public class CameraImaging
    {
        // enumerate video devices
        public FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice );
        //camera
        private VideoCaptureDevice _videoSource;
        public Bitmap bitmap = new Bitmap(10, 10);
        public VideoCaptureDevice videoSource
        {
            get
            {
                return _videoSource;
            }
            set
            {
                _videoSource = value;
                // set NewFrame event handler
                _videoSource.NewFrame +=new NewFrameEventHandler(videoSource_NewFrame);
            }
        }
        //screen shot
        
        public CameraImaging(VideoCaptureDevice videoDevice)
        {
            // create video source
            VideoCaptureDevice videoSource = videoDevice;
        }
        public CameraImaging()
        {

        }
        private void videoSource_NewFrame( object sender, NewFrameEventArgs eventArgs )
        {
            // get new frame
            lock (bitmap)
            {
                bitmap = (Bitmap)eventArgs.Frame.Clone();
                // process the frame
            }
            
        }
    }


and run the video in MainForm... this will make one image (bitmap):
C#
camImg.videoSource.Start();
lock (mImageLock)
{
    Bitmap tmp = (Bitmap)camImg.bitmap.Clone();

    if (InvokeRequired)
    {
        BeginInvoke(new MethodInvoker(() =>
        {
            pictureBox1.Image = tmp;
            pictureBox1.Invalidate();
        }));
    }
    else
    {
        pictureBox1.Image = tmp;
        pictureBox1.Invalidate();
    }
}
camImg.Video.Stop();
 
Share this answer
 
Comments
Kushina 12-Nov-12 11:14am    
thank you ( Pepin z Hane) for your useful reply , this camera has its own commands and this is the manual http://www.mediafire.com/view/?ec79xt02620zil5[^] I dont know at the moment if the code you mentioned in your reply can be applied to this camera because i have not got the camera with me now .

we are trying now to write 2 functions ::

1- TakePicture
2- ReadJpegFileContents

we are finding difficulties in writting the 2 functions because we are a beginners
in c# and we didnt study it in our course .

we will upload the code that we wrote later on !! .

we will appreciate any help in this feild or any references that might help

thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900