{A}{S0}
简介
此应用程序,用于显示电脑如何与人类互动和转换命令行动,他/她的议案。它检测的议案,该议案,并转换成相应的命令行动。
背景
检测运动,它使用anbsp的;减去两个图像的简单算法。每一个形象upnbsp;三层:红色,蓝色和绿色。因此,图像中的每个像素拥有相应的RGB三个值。使用代码
上面的代码片断表明,它很容易得到一个矩阵形式的字节[,]从位图图像。一旦你有两个连续的Web - CAM帧矩阵,你可以减去他们找到矩阵,显示了每个像素的议案。public ImageMatrix(Bitmap image) //constructor
{
this.width = image.Width;
this.height = image.Height;
byte[,] function = new byte[width, height];
//define bounds of function
//unsafe bitmap to iterate through the image
unSafeBitmap usb = new unSafeBitmap(image);
usb.LockImage();
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height; j++)
{
/* Reading average (gray scale)
value for each of the pixel
* and storing it in function*/
this.function[i, j] = usb.GetAverage(i, j);
}
}
}
在我本文提供的示例程序,有五个按钮:{C}
你也可以很容易地修改代码来控制任何你想,你甚至可以添加更多的虚拟按钮!如果您有关于该计划的运作的问题,然后在此留下您的意见。