a laser detection project i need help with

OpenMV related project discussion.
orisivan450
Posts: 5
Joined: Wed Mar 04, 2020 2:22 am

a laser detection project i need help with

Postby orisivan450 » Wed Mar 04, 2020 2:29 am

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
User avatar
kwagyeman
Posts: 3985
Joined: Sun May 24, 2015 2:10 pm

Re: a laser detection project i need help with

Postby kwagyeman » Wed Mar 04, 2020 12:18 pm

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.
Nyamekye,
orisivan450
Posts: 5
Joined: Wed Mar 04, 2020 2:22 am

Re: a laser detection project i need help with

Postby orisivan450 » Thu Mar 05, 2020 2:26 am

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 ?
User avatar
kwagyeman
Posts: 3985
Joined: Sun May 24, 2015 2:10 pm

Re: a laser detection project i need help with

Postby kwagyeman » Thu Mar 05, 2020 12:49 pm

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.
Nyamekye,
orisivan450
Posts: 5
Joined: Wed Mar 04, 2020 2:22 am

Re: a laser detection project i need help with

Postby orisivan450 » Thu Mar 12, 2020 3:31 am

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)
User avatar
kwagyeman
Posts: 3985
Joined: Sun May 24, 2015 2:10 pm

Re: a laser detection project i need help with

Postby kwagyeman » Sat Mar 14, 2020 12:24 pm

Hi, you can use the Threshold Editor under tools -> Machine vision to get the lab color thresholds of an object.
Nyamekye,
orisivan450
Posts: 5
Joined: Wed Mar 04, 2020 2:22 am

Re: a laser detection project i need help with

Postby orisivan450 » Wed Mar 18, 2020 5:16 am

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 ?
User avatar
kwagyeman
Posts: 3985
Joined: Sun May 24, 2015 2:10 pm

Re: a laser detection project i need help with

Postby kwagyeman » Thu Mar 19, 2020 12:18 pm

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?
Nyamekye,
orisivan450
Posts: 5
Joined: Wed Mar 04, 2020 2:22 am

Re: a laser detection project i need help with

Postby orisivan450 » Fri Mar 20, 2020 6:41 am

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)
User avatar
kwagyeman
Posts: 3985
Joined: Sun May 24, 2015 2:10 pm

Re: a laser detection project i need help with

Postby kwagyeman » Fri Mar 20, 2020 1:56 pm

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.
Nyamekye,

Return to “Project Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests