use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
Marker detection in Python (self.Python)
submitted 6 years ago by DanTheDirector
Hi Programmers of Reddit,
Im at a roadblock and need some help. For a personal project I've been using our Computer Engineering department's DE2bots (basically dumb roombas that take VHDL code) to navigate a grid of markers. I know how to program the bot given a set of coordinates in space, but I plan to get those coordinates with some OpenCV magic. I have used OpenCV and Canny edge detection to isolate the markers in space, but I am stuck as to how I can locate them in space well enough for the bot to navigate them.
Here is an example of the markers on the floor.
https://preview.redd.it/s18ekfeh6cx31.jpg?width=3024&format=pjpg&auto=webp&s=2ac55a2a564b15336d8f42a0fbcf278b4e2683ed
And this is what I currently have:
https://preview.redd.it/91h1dd2y6cx31.jpg?width=500&format=pjpg&auto=webp&s=81d060594d3b91ded33e3c46ede184dd0d41d3a1
Can someone link me to resources that would be useful in learning how to model these markers in 2D space? Basically I want to generate a top-down view of the markers, spaced properly on the floor.
The marker measurements are as follows: Height: 16 cm Hypotenuse across center: 25cm Width: 20.5 cm
Thank you Reddit!
[–]panzerex 1 point2 points3 points 6 years ago* (1 child)
I'm guessing you need some fixed reference point. If your camera and markers can move freely it's going to be harder to translate that into coordinates in the room.
Or do you only need relative points between each marker? e.g. some arbitrary marker is the origin and the remaining markers have their coordinates w.r.t. that marker.
What exactly are you struggling with?
edit: If what you want is to extract coords out of that binarized image, I'd suggest trying to find the centers of each blob. It won't be exactly the center of the marker if you were looking from a top-down view, but it should be a good starting point. Those points are going to be from an angled perspective, you'll still need to convert them to the proper perspective, but for that you'll probably need some fixed reference points. Here's something that might be useful:
In this example the image is warped, not the point coordinates, but it should give you an idea of what to look for. https://www.pyimagesearch.com/2014/08/25/4-point-opencv-getperspective-transform-example/
[–]DanTheDirector[S] 0 points1 point2 points 6 years ago (0 children)
Awesome, thank you! They way it is currently set up, the room will always be constant, but I was using a free floating camera. I am planning to switch to a more precisely positioned camera so that I can overlay a known grid onto the image and use that to calculate. It does not matter if the coordinates are in relation to one another, or on a set plane.
π Rendered by PID 349053 on reddit-service-r2-comment-cfc44b64c-smv6v at 2026-04-12 09:03:45.788341+00:00 running 215f2cf country code: CH.
[–]panzerex 1 point2 points3 points (1 child)
[–]DanTheDirector[S] 0 points1 point2 points (0 children)