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. angular.isUndefined()

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  2. window7环境下ZooKeeper的安装及运行

    简介 ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是Hadoop和Hbase的重要组件.它是一个为分布式应用提供一致性服务的软件,提 ...

  3. RabbitMQRPC 官方demo

    public class RPCServer { public static void Test() { var factory = new ConnectionFactory() { HostNam ...

  4. ckeditor+ckfinder

    官方地址:http://ckeditor.com/ 复制ckeditor和ckfinder的文件夹到项目根路径下 拷贝ckfinder的config.xml到WEB-INF下 <config&g ...

  5. 封装一个 员工类 使用preparedStatement 查询数据 (2) 使用 arrayList 集合

    创建 员工=类生成 有参构造 get set 方法 toString 方法 package cn.hph; public class emp1 { //创建员工类的属性 private int id; ...

  6. 根据excel表格字段生成sql语句

    根据excel表格字段生成sql语句 1.1 前言 根据excel表格字段生成sql语句主要是利用了excel的拼接函数 CONCATENATE .该实例主要以mysql脚本支持.实例需求如下:exc ...

  7. 基于js的数据结构与算法-数组

    Given an array of integers, return indices of the two numbers such that they add up to a specific ta ...

  8. 高德地图JS API获取经纬度,根据经纬度获取城市

    <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...

  9. [Swift]LeetCode12. 整数转罗马数字 | Integer to Roman

    Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 ...

  10. [Swift]LeetCode302. 包含黑色像素的最小矩形 $ Smallest Rectangle Enclosing Black Pixels

    An image is represented by a binary matrix with 0 as a white pixel and 1 as a black pixel. The black ...