1

enter image description here

* Cx , Cy= Center (X coordinates , Y coordinates)
Row P , Col P = Row and Column Pixel values *

Given a scenario like above, I wish to extract the corresponding row and column pixel values of the selected cX and cY.

Example: if cX value = (min(cX) +/- 10) and cY = (min(cY) +/- 10) then return the corresponding row and column pixel values.

Expected output: cX = 298 , cY = 270 RowP = 842, and ColP = 505

1 Answer 1

1

Assuming your data is a numpy matrix called 'values':

cx_min = min(values[:, 1])
cy_min = min(values[:, 2])
for i in range(0, len(values[:, 1])):
    cx = values[i, 1]
    cy = values[i, 2]
    if cx in range(cx_min-10, cx_min+11):
            if cy in range(cy_min-10, cy_min+11):
                    rowp = values[i, 3]
                    colp = values[i, 4]
                    print(cx, cy, rowp, colp)

This prints:

(298.0, 270.0, 842.0, 505.0)
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much , I was thinking on the right path but just couldn't prepare the syntax :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.