Fast image coordinate lookup in Numpy
Posted
by
victor
on Stack Overflow
See other posts from Stack Overflow
or by victor
Published on 2012-10-02T03:34:50Z
Indexed on
2012/10/02
3:37 UTC
Read the original article
Hit count: 197
I've got a big numpy array full of coordinates (about 400):
[[102, 234],
[304, 104],
....
]
And a numpy 2d array my_map of size 800x800.
What's the fastest way to look up the coordinates given in that array? I tried things like paletting as described in this post: http://opencvpython.blogspot.com/2012/06/fast-array-manipulation-in-numpy.html but couldn't get it to work.
I was also thinking about turning each coordinate into a linear index of the map and then piping it straight into my_map like so:
my_map[linearized_coords]
but I couldn't get vectorize to properly translate the coordinates into a linear fashion. Any ideas?
© Stack Overflow or respective owner