When running the “python get_blocks.py” command, only one block per output is shown to the screen. In the example arduino code, it’s accessed as an array[i]. The get_blocks.py seems to only print 1 block, even if I increase the max_blocks. I’m sure it’s a simple fix but I’m unfamiliar with python. What do I need to modify to see all detected blocks + signatures? Thanks.
I can confirm this behavior. Although pixy_get_blocks returns the correct number of objects detected, it only seems to write the first block to the SWIG Block object. The Block argument in the C/C++ pixy_get_blocks is a pointer to a C Block struct; is that why Python is only getting a reference to the first block?
Also, I noticed this in the pixy.py SWIG file Block class definition (lines 111-113):
def init(self):
this = _pixy.new_Block()
try: self.this.append(this)
but Block().this is a “PySwigObject” and not iterable, so maybe the try-except clause is not adding the next blocks past the first?
-numlock
EDIT: Found this related post, but they have the opposite problem: [[http://www.cmucam.org/boards/9/topics/4961?r=5025#message-5025]]
Hello Timothy and Jesse,
Thanks for the messagae. Let me bring in the person who wrote this code and get back to you.
Edward
Tim & Jesse,
I’ve updated the Python SWIG example to support reading more than one block per frame.
Try the latest commit: https://github.com/charmedlabs/pixy/commit/4175201a3ac308db3b93f9f9d0b70443e3efa342
Thanks,
John