本文介绍了使用OpenCV和C ++的激光检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我想用网络摄像头跟踪激光点(这是在墙上),我使用openCV来完成这项任务。



谢谢!

解决方案



您可以使您的图像变得如此暗淡,您可以根据背景的稳定性和想要处理的图片选择三种选项。你唯一可以看到的是激光点。您可以通过关闭光圈和/或缩短快门时间来实现。即使使用便宜的网络摄像头,这通常可以在驱动程序中完成。一旦你做到这一点,找到激光点的工作是很容易的。你使图像尽可能暗,因为通常激光照射的点太明亮,照相机不能拾取。这意味着(如你所经历的),你不能辨别光激光点和图像中的其他光对象。



如果你有其他用途的图像(显示给人),你的背景是稳定的,你也可以使用平均值的最后几个视频图像作为背景,然后找到那个背景和最新图像之间存在巨大差异的地方。这通常是激光指向的位置(如果你的背景是足够稳定的话,就是这样)。



最后,如果你的背景不稳定,你的图像非常暗你的最后一个选择是寻找所有的像素,它们都是非常明亮,在红色通道比他们在绿色和蓝色(如果你使用红色激光)更亮。这个系统仍然会被白点分散,但不会像找到明亮的像素一样多。如果激光指示点的中心确实显示为明亮的白色,而不管激光颜色,那么这种技术将允许你找到这个亮点周围的环(点的外部,激光不像它在中心,使其显示与图像中的激光的实际颜色)。然后,您可以使用简单的,(可能就足以填满这些圈子了。


I want to track a laser light dot(which is on a wall) with a webcam and i am using openCV to do this task. can anybody suggest me a way to do it with C++.

Thank you !

解决方案

You have three options depending on the stability of your background, and the things you want to do with the image.

You can make your image so dark that the only thing you can see is the laser-point. You can do this by closing the diaphragm and/or reducing the shutter time. Even with cheap webcams this can usually be done in the driver. Once you've done this the job of finding the laser point is very easy. You make the image as dark as possible because usually the point where the laser shines is way too bright for the camera to pick up. This means (as you have experienced) that you cant discern between the light laser dot and other light objects in the image. By making it darker you now can do this.

If you have other uses for your image (showing it to people) and your background is stable you can also use the average of the last few video images as a "background" and then find the spot where there is a large difference between that background and the newest image. This is usually where the laser is pointed (again, if your background is stable enough) .

Finally, if your background is not stable and you don't want to make your image very dark your final option is to look for all pixels that are both very bright, and brighter in the red channel than they are in green and blue (if you are using a red laser). This system will still be distracted by white spots, but not as much as just finding the bright pixels. If the center of your laser-pointer spot is indeed showing up as bright white regardless of laser color then this technique will allow you to find "rings" around this bright spot (the outer part of the dot where the laser is not as bright as it is in the center so that it shows up with the actual color of the laser in the image). You can then use simple morphological operations, (probably closing is enough) to fill these circles.

这篇关于使用OpenCV和C ++的激光检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 07:38