Finding all the X and Y coordinates of an image in python opencv

431
May 19, 2017, at 10:44 PM

I am a beginner in opencv-python. I want to get all the X and Y coordinates of pixels from this image and store it in an array. Can anyone give me an idea on how to proceed?

Image for detecting all the X and Y coordinates

Answer 1

this post lets you know how to get the pixel of an image http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_core/py_basic_ops/py_basic_ops.html

if you just iterate over the image in a nested for-loop you can perform whatever operation you want on said pixel eg, add x and y to an array if the colour isnt white

EDIT: i had to read up on what Chris commenting on the post meant by XY Problem but i agree, is there something youve tried and hasnt worked that youd like us to help fix?

READ ALSO
wrong json output in python

wrong json output in python

I'm sure this is simple but my heads not with it today, I'm trying to output a JSON file in this format:

382
Pygame - speed variable cannot change from 5

Pygame - speed variable cannot change from 5

I have absolutely no idea why, but when I try to change my speed variable from 5 to any other number, the whole thing hangs after one repetition

278
How to do this bubble sort on pseudocode [on hold]

How to do this bubble sort on pseudocode [on hold]

Hi I'm trying to a bubble sort

248
Python - How to change type of value in list [duplicate]

Python - How to change type of value in list [duplicate]

This question already has an answer here:

386