与LinksPrite相机进行通讯 [英] Communicate with linksprite camera

查看:79
本文介绍了与LinksPrite相机进行通讯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

发送拍照"命令后,
如何获取表示图像的字节并将其存储在内存流中?

after sending the "take picture" command ,
How to get back the bytes that represent the image and store them in a memory stream ?

推荐答案

我不知道您使用的是哪个库,甚至我也不知道不知道linkprite相机是什么意思,但是请尝试使用此框架来处理相机或摄像机: http://www.aforgenet.com/framework/ [ ^ ]

我正在使用摄像机,请尝试以下操作:
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
            }
            
        }
    }



并在MainForm中运行视频...这将生成一个图像(位图):



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();


这篇关于与LinksPrite相机进行通讯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆