IrisDetector
IrisDetector copied to clipboard
Cannot index the second last row of appended values
If irises is an array with rows of values which are being appended constantly, then I should be able to index the second last row of the appended values with [-2] or even [0][-2]. But when I try to it fetches an error that the array is not big enough (although it is (2,2)). I have tried all sorts of indexing methods none of which index the second to last row, they only index the last row. I have also tried different ways of appending the values to the array, none of which I had success with. If you happen to know how I can index the second last row appended onto the irises or a different appending method, it would be appreciated if you can help me out!
Hmm, irises[-2]
works well for me. Keep in mind that irises
is numpy.ndarray
for some reason.
Have a look at screenshot from my IDE debugging session. I added a note to readme, this code was intended to be run on Python 2.7, I also added requirements.txt
, as there is a mess with opencv versions. Hope that you'll find this helpful.
Thanks for the quick response! Your results are precisely what I am trying to index, but how do I put the expression into the code? In other words, how do I translate the self.irises[-2] into code? (Note: I am running it on python 3.7, if it makes a difference) Having tried [-2] it gives me [[271.49973 324.8698 ] [318.79807 332.70883]]-the whole array(print(irises) and [271.49973 324.8698 ]-(print(irises[-2]), it seems it indexes the wm element? And [0] also indexes the wm, so I think the first indexing number indexes one of the elements. For instance, [0] indexes wm and [1] indexes hm. The second indexing number seems to index one of the columns of the previously selected element. So [0][1] indexes the wm element and the second column. The question is how do I get around this problem? You do have an intriguing way of approaching this problem, but again I am confused as to how to implement it in the code? Would you happen to know? Thanks again for your guidance!