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

DSAPI之摄像头追踪指定颜色物体的更多相关文章

  1. Python OpenCV4趣味应用系列(四)---颜色物体实时检测

    今天,我们来实现一个视频实时检测颜色物体的小实例,视频中主要有三个颜色物体,我们只检测红色和绿色的球状物体,如下图所示: 第一步需要打开视频(或者摄像头): cap = cv2.VideoCaptur ...

  2. Unity 2D游戏开发教程之摄像头追踪功能

    Unity 2D游戏开发教程之摄像头追踪功能 上一章,我们创建了一个简单的2D游戏.此游戏中的精灵有3个状态:idle.left和right.这看起来确实很酷!但是仅有的3个状态却限制了精灵的能力,以 ...

  3. xcode 产生指定颜色的图片imageWithColor

    是在万能的stackOverflow上找到的答案,留下了, 原地址:http://stackoverflow.com/questions/6496441/creating-a-uiimage-from ...

  4. Qt5:图片彩色键控,设置图片中指定颜色的像素为透明

    有图片 1.png 设置该图中的颜色为粉红色的像素为透明 QPixmap pix("1.png"); QBitmap mask= pix.createMaskFromColor(Q ...

  5. opencv-原图基础上添加指定颜色

    前言 项目中需要将某些区域使用不同的颜色表示出来,同时能够看到原图作为底色. 代码 #include "opencv2/highgui/highgui.hpp" #include ...

  6. javascript把RGB指定颜色转换成十六进制颜色(Converting R,G,B values to HTML hex notation)

    Prologue 看见一篇非常好的外国文章,Making annoying rainbows in javascript,事实上我当时非常想把它翻译下来的,可是对于一个连六级都没过的人确实有点难度,一 ...

  7. python项目中输出指定颜色的日志

    起因 在开发项目过程中,为了方便调试代码,经常会向stdout中输出一些日志,默认的这些日志就直接显示在了终端中.而一般的应用服务器,第三方库,甚至服务器的一些通告也会在终端中显示,这样就搅乱了我们想 ...

  8. python-opencv 分离图片(视频)中的某一颜色物体

    看代码: import cv2 as cv import numpy as np def separate_color(frame): cv.imshow("原图", frame) ...

  9. OpenGL编程(一)渲染一个指定颜色的背景窗口

    上次已经搭好了OpenGL编程的环境.已经成功运行了第一个程序.可只是照搬书上的代码,并没弄懂其中的原理.这次通过一个小程序来解释使用GLUT库编写OpenGL程序的过程. 程序的入口 与其他程序一样 ...

随机推荐

  1. placeholde属性在IE10以下浏览器上的兼容方案

    首先,判断浏览器是否支持placeholder属性:目前经验来看placeholder属性在     IE10及以上   才能正常显示,而我们实际项目中往往要求兼容到   IE8 var input ...

  2. 255.Spring Boot+Spring Security:使用md5加密

    说明 (1)JDK版本:1.8 (2)Spring Boot 2.0.6 (3)Spring Security 5.0.9 (4)Spring Data JPA 2.0.11.RELEASE (5)h ...

  3. Hash及HashMap简介

    Hash简介: Hash,一般翻译做“散列”,也有直接音译为“哈希”的,就是把任意长度的输入(又叫做预映射pre-image)通过散列算法变换成固定长度的输出,该输出就是散列值.这种转换是一种压缩映射 ...

  4. [Swift]LeetCode49. 字母异位词分组 | Group Anagrams

    Given an array of strings, group anagrams together. Example: Input: ["eat", "tea" ...

  5. [Swift]LeetCode250.计数相同值子树的个数 $ Count Univalue Subtrees

    Given a binary tree, count the number of uni-value subtrees. A Uni-value subtree means all nodes of ...

  6. [Swift]LeetCode473. 火柴拼正方形 | Matchsticks to Square

    Remember the story of Little Match Girl? By now, you know exactly what matchsticks the little match ...

  7. [Swift]LeetCode706. 设计哈希映射 | Design HashMap

    Design a HashMap without using any built-in hash table libraries. To be specific, your design should ...

  8. [Swift]LeetCode836. 矩形重叠 | Rectangle Overlap

    A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bot ...

  9. js的预解析

    在ES6之前,变量使用var声明,会存在变量的预解析(函数也有预解析).ES6引了let和const,但是现阶段ES6并没有完全普及,而且很多比较老的代码都还是按照ES5的标准甚至是ES3的标准来书写 ...

  10. Python—day17时间模块、系统模块、递推遍历、序列化

    一.time'''时间戳(timestamp):time.time()延迟线程的运行:time.sleep(secs)(指定时间戳下的)当前时区时间:time.localtime([secs])(指定 ...