DSAPI之摄像头追踪指定颜色物体
2015-07-18 21:27
363 查看
Private CAM As New DSAPI.摄像头_avicap32
Private Clr As Color = Color.FromArgb(230, 50, 50)
Private _Location As Point
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
End
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
CheckForIllegalCrossThreadCalls = False
CAM.在指定控件上启动视频预览(Label1)
MSK.Show()
MSK.Owner = Me
Dim T As New Threading.Thread(AddressOf DoThd)
T.Start()
End Sub
Private Sub DoThd()
While True
Using B As New DSAPI.图形图像.图像识别(CAM.截取图像)
Dim Rct As Rectangle = B.获取指定颜色最大包含区域(Clr, 0.2)
Rct = Label1.RectangleToScreen(Rct)
_Location = Rct.Location + New Point(Rct.Width / 2, Rct.Height / 2)
Me.Invoke(New CrossAppDomainDelegate(AddressOf SetMove))
'MSK.Location = New Point(Rct.X + Rct.Width / 2, Rct.Y + Rct.Height / 2)
'Me.Text = Rct.Location.ToString
End Using
Threading.Thread.SpinWait(100)
Application.DoEvents()
End While
End Sub
Private Sub SetMove()
MSK.Location = _Location - New Point(MSK.Width / 2, MSK.Height / 2)
End Sub
相关文章推荐
- IOS开发-12.Autoresizing概述
- HUD 4707
- codeforces Gym 100187J J. Deck Shuffling dfs
- jquery动画总结
- ASP.net后台弹出消息对话框的方法!【转】
- 生产者消费者模式(1)
- 【Spark Core】TaskScheduler源码与任务提交原理浅析2
- 10行Java代码实现最近被使用(LRU)缓存
- OpenGL_ES 创建一个平面 绘制纹理 响应输入事件
- POJ1088滑雪(入门级DP)
- bzoj1257[CQOI]余数之和
- ZOJ 2104 Let the Balloon Rise
- poj3984-迷宫问题(广搜)
- Android学习笔记之dispatchTouchEvent和OnInterceptTouchEvent和OnTouchEvent三个方法之间的联系...
- Eddy's research I
- 【Spark Core】TaskScheduler源码与任务提交原理浅析1
- 每个程序员都需要了解的一个SQL技巧
- SWIFT中获取配置文件路径的方法
- 迭代器模式
- git使用的基础及常用命令