Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
after sending the "take picture" command ,
How to get back the bytes that represent the image and store them in a memory stream ?
Posted 10-Nov-12 10:15am
Kushina265
Comments
Pepin z Hane at 10-Nov-12 16:49pm
   
Which library do you use? takePicture is a method of which class of which library?
Kushina at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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:
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):
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();
  Permalink  
Comments
Kushina at 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)

  Print Answers RSS
0 OriginalGriff 210
1 Richard MacCutchan 100
2 kbrandwijk 90
3 ProgramFOX 80
4 Mukesh Bhagat 65
0 Sergey Alexandrovich Kryukov 9,050
1 OriginalGriff 8,151
2 CPallini 2,613
3 Richard MacCutchan 2,221
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 10 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100