展开全部
应该要用到通讯的知识,你可以研究下这个。
我自己的思路是,采集视频信息然后通过TCP/IP或者UDP进行数据包传输可能要考虑端口的分配了。
不知道对不对,给你个参考吧。
我自己的思路是,采集视频信息然后通过TCP/IP或者UDP进行数据包传输可能要考虑端口的分配了。
不知道对不对,给你个参考吧。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
深圳量子动力
2024-10-28 广告
2024-10-28 广告
在量子动力(深圳)计算机科技有限公司,我们致力于将前沿技术融入安防与智能识别领域。摄像头人脸捕捉技术,依托深度学习算法与高效图像处理能力,能够在复杂环境中迅速锁定并精准捕捉人脸信息。这一技术不仅提升了监控系统的智能化水平,还在公共安全、门禁...
点击进入详情页
本回答由深圳量子动力提供
展开全部
这个简单那 我做过一个 连截图的提供了 呵呵
不懂问我 我的邮箱:aying996@163.com
using System;
using System.Runtime.InteropServices;
using System.Drawing.Imaging;
using System.Windows.Forms;
using System.Drawing;
namespace YHhotel.YHhotelWindows
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
public class video
{
//5个传入参数
private IntPtr myHand;
private int myWidth;
private short myHeight;
private int myLeft;
private int myTop;
//调用avicap32.dll
public struct videohdr_tag
{
public byte[] lpData;
public int dwBufferLength;
public int dwBytesUsed;
public int dwTimeCaptured;
public int dwUser;
public int dwFlags;
public int[] dwReserved;
}
[DllImport("avicap32.dll",CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)]
public static extern int capCreateCaptureWindowA([MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszWindowName, int dwStyle, int x, int y, int nWidth, short nHeight, int hWndParent, int nID);
[DllImport("avicap32.dll", CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)]
public static extern bool capGetDriverDescriptionA(short wDriver, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszName, int cbName, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszVer, int cbVer);
[DllImport("user32", CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)]
public static extern bool DestroyWindow(int hndw);
[DllImport("user32", EntryPoint="SendMessageA", CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)]
public static extern int SendMessage(int hwnd, int wMsg, int wParam, [MarshalAs(UnmanagedType.AsAny)] object lParam);
[DllImport("user32", CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)]
public static extern int SetWindowPos(int hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
[DllImport("vfw32.dll")]
public static extern string capVideoStreamCallback(int hwnd,videohdr_tag videohdr_tag);
[DllImport("vicap32.dll", CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)]
public static extern bool capSetCallbackOnFrame(int hwnd,string s);
//自定义参数:
private int hHwnd;
//构造函数
public video(IntPtr myPtr,int left, int top, int width, short height)
{
myHand=myPtr;
myLeft=left;
myTop=top;
myWidth=width;
myHeight=height;
//
// TODO: 在此处添加构造函数逻辑
//
}
//打开视频:
public void opVideo()
{
int intDevice=0;
string refDevice=intDevice.ToString();
hHwnd=capCreateCaptureWindowA(ref refDevice,1342177280,0,0,640,480,myHand.ToInt32(),0);
if(SendMessage(hHwnd,0x40a,intDevice,0)>0)
{
SendMessage(this.hHwnd,0x435,-1,0);
SendMessage(this.hHwnd,0x434,0x42,0);
SendMessage(this.hHwnd,0x432,-1,0);
SetWindowPos(this.hHwnd,1,0,0,myWidth,Convert.ToInt32(myHeight),6);
}
else
{
DestroyWindow(this.hHwnd);
}
}
//停止视频
public void CloVideo()
{
SendMessage(this.hHwnd,0x40b,0,0);
DestroyWindow(this.hHwnd);
}
//捕获视频
public Image CatchVideo()
{
SendMessage(this.hHwnd,0x41e,0,0);
IDataObject obj1=Clipboard.GetDataObject();
Image getIma=null;
if(obj1.GetDataPresent(typeof(Bitmap)))
{
Image image1=(Image)obj1.GetData(typeof(Bitmap));
getIma=image1;
}
return getIma;
}
}
}
不懂问我 我的邮箱:aying996@163.com
using System;
using System.Runtime.InteropServices;
using System.Drawing.Imaging;
using System.Windows.Forms;
using System.Drawing;
namespace YHhotel.YHhotelWindows
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
public class video
{
//5个传入参数
private IntPtr myHand;
private int myWidth;
private short myHeight;
private int myLeft;
private int myTop;
//调用avicap32.dll
public struct videohdr_tag
{
public byte[] lpData;
public int dwBufferLength;
public int dwBytesUsed;
public int dwTimeCaptured;
public int dwUser;
public int dwFlags;
public int[] dwReserved;
}
[DllImport("avicap32.dll",CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)]
public static extern int capCreateCaptureWindowA([MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszWindowName, int dwStyle, int x, int y, int nWidth, short nHeight, int hWndParent, int nID);
[DllImport("avicap32.dll", CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)]
public static extern bool capGetDriverDescriptionA(short wDriver, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszName, int cbName, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszVer, int cbVer);
[DllImport("user32", CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)]
public static extern bool DestroyWindow(int hndw);
[DllImport("user32", EntryPoint="SendMessageA", CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)]
public static extern int SendMessage(int hwnd, int wMsg, int wParam, [MarshalAs(UnmanagedType.AsAny)] object lParam);
[DllImport("user32", CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)]
public static extern int SetWindowPos(int hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
[DllImport("vfw32.dll")]
public static extern string capVideoStreamCallback(int hwnd,videohdr_tag videohdr_tag);
[DllImport("vicap32.dll", CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)]
public static extern bool capSetCallbackOnFrame(int hwnd,string s);
//自定义参数:
private int hHwnd;
//构造函数
public video(IntPtr myPtr,int left, int top, int width, short height)
{
myHand=myPtr;
myLeft=left;
myTop=top;
myWidth=width;
myHeight=height;
//
// TODO: 在此处添加构造函数逻辑
//
}
//打开视频:
public void opVideo()
{
int intDevice=0;
string refDevice=intDevice.ToString();
hHwnd=capCreateCaptureWindowA(ref refDevice,1342177280,0,0,640,480,myHand.ToInt32(),0);
if(SendMessage(hHwnd,0x40a,intDevice,0)>0)
{
SendMessage(this.hHwnd,0x435,-1,0);
SendMessage(this.hHwnd,0x434,0x42,0);
SendMessage(this.hHwnd,0x432,-1,0);
SetWindowPos(this.hHwnd,1,0,0,myWidth,Convert.ToInt32(myHeight),6);
}
else
{
DestroyWindow(this.hHwnd);
}
}
//停止视频
public void CloVideo()
{
SendMessage(this.hHwnd,0x40b,0,0);
DestroyWindow(this.hHwnd);
}
//捕获视频
public Image CatchVideo()
{
SendMessage(this.hHwnd,0x41e,0,0);
IDataObject obj1=Clipboard.GetDataObject();
Image getIma=null;
if(obj1.GetDataPresent(typeof(Bitmap)))
{
Image image1=(Image)obj1.GetData(typeof(Bitmap));
getIma=image1;
}
return getIma;
}
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询