1

having a lot of difficulty with numpy here, i am very new at numpy. i have used these codes:

pixelpoints = cv2.findNonZero(mask)

this returns a np.ndarray object that looks like this:

[[1288  700]]
[[1289  700]]
[[1290  700]]
[[1291  700]]
[[1287  701]]
[[1288  701]]
[[1289  701]]
[[1290  701]]
[[1291  701]]
[[1292  701]]

as you can see the first number of these pairs repeat quite often. in example, 1290 repeats at 700 and 701. i have a million of pairs like this in a np.ndarray object. Question: how do i find the minimum for a given first entry? let me elucidate my question. suppose for the first entry 1290, there are more than five hundred ordered pairs. how do i find the pair that has the least value for 1290 and max value for 1290? is there anyway to break this np.ndarray into simple arrays so that i can use max / min functions?

gluttony47
  • 91
  • 1
  • 6

0 Answers0