[SOLVED] Python multiple row addition

Hi touchdesigner community,

I am currently trying to evaluate an image with the number of white pixels in a 1280 by 720 image. I what to sum every pixels of a column wich means 720 pixels. I want to do that 1280 times seperatly. I know it is possible to do it in the CHOPs with an evaluate but I don’t what to have 1280 evalute CHOP in my patch. I just found on an other topic here a solution to sum the row of DAT table and want to adapt the code do it 1280 times the number of rows that I have with my image.I would love to combine all the data in an other table DAT with only one row that I would use for instancing in ty. I don’t know if anyone can help me I am quit new in the python world.

rowAddition.tox (1.4 KB)
whitePixels.tox (526 Bytes)

Many thanks in advance,
Jean-Sébastien Schnubb

This is not my area of expertise, but I got interested in your problem and came up with the method in here using OPs. I put some comments in but feel free to ask questions if what’s going on is unclear.
whiteSum.toe (8.3 KB)

Hi Ivan,

Wow nice you figured it out thanks alot. Never thought of using the anaylze TOP. It is way easier with the OPs than python.

J-S