a laser detection project i need help with

i am making project for school and i am using this camera for the project.
i need the camera to detect a laser spot and correct the driving motors to make the laser spot in the middle of the screen that way the machine will drive towards the laser spot at all time and will correct itself if the laser is not in the middle
i can use arduino or raspberry pi for this project but i dont know how to work with the camera and how to detect the laser(tried using the find circles but it didn’t work)
please help if you can

Please use the find_blobs() method and tune the camera too look for red. As for driving the motors you just need to make a PID loop based on the blob centroid X and Y values.

i wrote this find_blobs(73, 100, -20, 29, -34, 11)
i went to the Threshold Editor and found my min and max LAB numbers.
why it doesn’t work ?

Hi, can you look at the examples included with OpenMV IDE? Please see the color tracking examples. For example, see the single color tracking example. This shows off how to use the method correctly.

i didnt understood the what i need to put in the colors to make it work the generic red green and blue
i frame buffered it and this is the LAB i got (93, 100, -3, 8, -5, 4)

Hi, you can use the Threshold Editor under tools → Machine vision to get the lab color thresholds of an object.

ok i got it working on graysclae and rgb scale but each on are difrent in light and shadow. what i am trying to say that they are both not very accurate. is their any way i can make it more accurate ?

What’s the particular problem? The laser spit is not detected all the time? If so, you have to widen your thresholds. If this makes it hard to detect the laser only then you have to try more advanced image processing than only just color tracking. Can you give an example image of the scene?

right now i am using the grayscale color tracking and my thresholds values are (227, 255) it workok but i would like it to work better. the camera detects the laser spot but it doesn’t always stays on the spot at all time. secondly i would like it to track only the laser and right now it tracks all shapes that are bright enough (like the sun reflection from the window). i would like it now to only detect the laser maybe with blob detection or something like that but i would like it to be accurate enough even from a short distance( couple of meters)

Hi, you have to code up filtering algorithms now.

1st: To track just the laser spot you need to filter blobs that don’t match your expected size. For example, print out the attributes (just do print(blob)) of the blob that’s the laser spot and then reject blobs that aren’t near the same parameters.

2nd: You need to implement tracking. It will never be the case that you can track an object for every frame. So, you need to at a higher level, track where the object last was and then update the position when you have a new tracking result. To make the tracking even better… instead of doing a 100% update you should only slightly update the position of the tracked object based on a new detection weighted by a confidence score.

E.g. new_position = (old * (1 - confidence_percentage)) + (new * confidence_percentage) … for both x and y positions

Where confidence_percentage is some number between 0 and 1 that represents how good you think your detection result is based off of what the filtering algorithm you implement says.