Take the 2-minute tour ×
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

I got a tracked robot toy and I'm controlling it with an iPhone. The robot outputs a live camera feed of a known frame size and I'm displaying it on UIImage.

I've added a laser pointer to the robot and fixed it alongside the axis of the robot. I'm trying to detect the laser pointer dot on the image and thus try to calculate the proximity of the object. If the laser dot is far away from the center, I know that the robot is stuck against the wall and needs to back up.

How can I go about detecting a dot of bright white-red pixels on a screen? One solution would be to sample the color of pixels within a certain radius of the center and detect a blob bright color. Can anyone suggest an algorithm for this activity?

Another approach would be to keep track of the average position of the dot over the last few frames, thus reducing the guesstimate radius. If there's no dot within a pre-defined region, the search region may be expanded.

Finally, I want to be able to teach the robot to detect carpet around it. Carpet reflects a laser pointer in a certain way, and I want to understand how many frames around the robot have similar properties. If I know where the laser pointer is at a screen, I can clip a small rectangle from that image and compare them one to another. Is there an efficient way of comparing multiple small images to one another to understand if their silhouettes match?

I noticed that the laser is reflected off glossy surfaces, and the direction of this reflection may tell me something about the orientation of the surface in space, in accordance with the laws of refraction.

Thank you!

Laser Pointer close

Laser pointer 1

share|improve this question

migrated from stackoverflow.com Jun 19 '12 at 11:49

This question came from our site for professional and enthusiast programmers.

1  
Can you turn the laser pointer on and off in a pattern? Like one frame it's off, the next it's on, and you subtract subsequent frames to make it very obvious. –  endolith Jun 19 '12 at 17:29
    
That's a very good idea! But I don't have control over the laser pointer, its either on or off. –  Alex Stone Jun 23 '12 at 0:26

2 Answers 2

up vote 8 down vote accepted

OpenCV is compilable for iOS. While it may not be the most efficient it gives you the option of porting the algorithm. I have done a similar marker tracking problem using the ConDensation algorithm. Look up marker tracking with OpenCV. It is a VERY large research area and the exact algorithm you want depends completely on your application. If I remember correctly there are around 3000 reported image processing techniques - to pick a good one is a real art!

One solution would be to sample the color of pixels within a certain radius of the center and detect a blob bright color. Can anyone suggest an algorithm for this activity?

By the way, this is the basic idea behind what is called a particle filter (of which Condensation is one method). Well done you figured out the basic idea by your self!

Another approach would be to keep track of the average position of the dot over the last few frames, thus reducing the guesstimate radius. If there's no dot within a pre-defined region, the search region may be expanded.

This is called state persistance and can be modelled in various ways. The condensation algorithm uses a stochastic approach not dissimilar to a plain old Kalman filter.

Is there an efficient way of comparing multiple small images to one another to understand if their silhouettes match?

This one is a little more difficult. You could try template matching but I don't know how well it will perform on iOS (very heavy calculation and iOS camera is not well suited to it).

share|improve this answer
    
Paul, thank you for an incredibly detailed answer! I got OpenCV framework, and will look for examples of projects using it. –  Alex Stone Jun 18 '12 at 11:57

How about this code

https://www.youtube.com/watch?v=MKUWnz_obqQ

https://github.com/niitsuma/detect_laser_pointer

In this code HSV color are compared using hotelling's t square test

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.