- Home /
LED Tracking with Unity & emguCV
Hi!
I am currently working on a project, where i am trying to track four LED's with a camera. When a LED is found in the camera image it shall be tracked immediately. For the beginnning it should work with four LED's, later it should be irreleveant, how many LED's there are.
The programm should get the coordinates of the four LED's so that i can work with that.
I have tried a first approach with binary tresholding and contour finding, but that creates errors, like points found anywhere else.
Does anyone have a maybe better approach?
br
Be a bit more clear when you ask question. By track do you mean to follow a object then change if you press some button then follow another object
Answer by hoffmanuel · Apr 18, 2013 at 08:09 AM
The detection is working now. Code:
Image<Gray, Byte> cannyImage = _capture.QueryGrayFrame().ThresholdBinary(new Gray(250), new Gray(255)).Canny(new Gray(255).Intensity, new Gray(255).Intensity);
int count = 0;
for (Contour<Point> contours = cannyImage.FindContours(
Emgu.CV.CvEnum.CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE,
Emgu.CV.CvEnum.RETR_TYPE.CV_RETR_EXTERNAL); contours != null; contours = contours.HNext)
{
float x = (float)contours.BoundingRectangle.X;
float y = (float)contours.BoundingRectangle.Y;
....
}
The treshold is so high, because i am working with infrared
do you have any tutorial or guide or something like that ? I'm trying to do this too, but using the smartphone camera with Unity in Android
Your answer
![](https://koobas.hobune.stream/wayback/20220613083458im_/https://answers.unity.com/themes/thub/images/avi.jpg)