Python Forum

Full Version: Detecting multiple markers based on bright spots detection on raspberry pi 3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
We are doing a study end project, we're not used in programming so we're kinda stuck. Our project is based on real time markers detection (open cv) which reflects light (image tresholding). After three markers are detected using picamera, centroids of contours should be connected and after that, angle between such made lines should be measured. Here comes the question- is there any solution to attribute id's to markers given as contours so they won't be mistaken after changing mutual position (now, found contours are always numbered from left to right)  ?? Please help Undecided
I can't give an answer to you question, possibly because you are asking the wrong question :)

How can you tell markers have changed positions? In other words if you have markers A,B,C in the first image and X,Y,Z in the second, how can you tell that A,B,C have become X,Y,Z and not Z,X,Y?
Here is link to our code https://github.com/malinowydyplom/DYPLOM...eaded/1.py.
We were building our program using http://www.pyimagesearch.com/ blogs and tutorials from the start. In one, about detecting multiple bright spots in the image, he used contours sorting from left to right- same as you can see in our source code. Everything is ok as long as mutual orientation of markers stays as seen of no1. below. Then with no2. they sort again and we have problem - markers change they x,y coordinates and we're not able to measure proper angle between two lines.

[Image: CCF28112016_00000.jpg?raw=true]
We need some kind of identyfication, to attribute known id to, for example, middle marker so that the rest contours could follow him.
I don't think you can go that route... attribute an id based on what? (hint: this criteria would need to be valid in both images). What you can do is measure the distance between the markers of the first image and those of the second, and see if some markers have remained within some distance of their original position, or in a more general case consider that the combo of markers in the 2nd image that minimizes the sum of the distances with the markers on the first image image is the new sequence of markers. In your example you would likely discover that M1, M2, M3 are now M2, M1, M3.
Is there any identifying features of the markers that make them unique?
Would it be possible to identify by specific color, size, etc. or as i suspect,
does that change as well?
We should use, as told from our project supervisor, 3 identical reflective markers from one of type below (square, circle or spherical)

[Image: 15300701_938603056270465_647485002_n.jpg?raw=true][Image: 15240042_938602822937155_237154649_n.jpg?raw=true]
Ok, here's an example of how to differentiate between a circle and square, http://stackoverflow.com/questions/31952...age-python
but, alas that won't help since they must be identical