如何使用网络摄像头在c#中创建分数点系统 [英] How do I create a score point system in c# with webcam

查看:119
本文介绍了如何使用网络摄像头在c#中创建分数点系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我正在做一个项目(和Lego Mindstorms一起卷曲)我已经让网络摄像头正常工作(这个网络摄像头会检测颜色并跟踪物体)。但是现在我被卡住了。我想用visual studio制作一个评分系统,但我不知道如何开始。我想给一个物体(冰球)分数,如果冰球更接近内圈,那么它将获得更多的分数。所以离你越近,得分就越高。



也许有人可以告诉我我应该使用的对象,也许可以告诉我一些提示或其他东西。



我只开始使用c#6周,所以我还是这个菜鸟



谢谢你正在阅读!

Hello,

I'm doing a project (curling with Lego Mindstorms) and I already got the webcam working (this webcam detects color and traces objects). But now I'm stuck. I want to make a scoring system with visual studio but I don't know how to start. I want to give points to a object(puck) and if the puck is closer to the inner circle then it will get more points. So the closer you are, how higher your score will be.

Can maybe somebody tell me wich objects I should use and maybe tell some tips or something.

I only started working with c# 6 weeks so I'm still a noob to this

thank you for reading!

推荐答案

你将处理图像,所以在这里你去:





1.获取内圈中心的屏幕坐标

(x c ,y c

2.获取冰球的屏幕坐标(x p ,y p

3.计算距离他们两个:sqrt [(x p -x c 2 +(y p -y <小> c 2 ]

4.按比例分配这个距离。
You will be processing images, so here you go:


1. Get the screen coordinate of the center of the inner circle
(xc,yc)
2. Get the screen coordinate of your puck (xp,yp)
3. Compute the distance between the two of them: sqrt[(xp-xc)2+(yp-yc)2]
4. Apply points proportionnaly to this distance.


这篇关于如何使用网络摄像头在c#中创建分数点系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆