numPy array to TOP?

Hi, I see one can can invoke the TOP.numpyArray() method to convert an image into a Python numpy array.

But how can I export/display a numpy array on a TOP? That is, the reverse of the above method.

Currently you need to do it into a CHOP then CHOP to TOP, but we just received another request for this so are working on and RFE to make it easier.

Yes, because having a CHOP in the middle seems taxing. Looking forward!

Ben - is it possible that whatever method used to directly fill a TOP from memory could be designed in such a way that SSBO’s could be externally filled and read as well? This would unlock a lot of interesting possibilities with the GLSL TOP and MAT.

1 Like

Hi! I’m currently working on a ML implementation and the numpyArray Top helps a lot, so I would highly appreciate a np to TOP too. could you elaborate on how you can bring a np.array into a CHOP in the meanwhile? As far as i got it, there is no direct way of passing the values because the CHOPs are read-only? Writing out a table and getting the format right is quite tedious work… and might result in slow performance? Really appreciate your help!

there’s also the Script CHOP. See example making a chop with info from a numpyarray on the OpenCV wiki page

thnx nettoyeur but in the example a certain position of the array is assigned to a variable/channel. assigning the whole array is not possible. of course it would be possible to write a routine to assign each value of the array to DAT… but then again I think it is really bad performance wise.

It is possible to create channels & samples in a CHOP for all values in your numpyArray, but indeed it will be terribly slow as it is done in Python. Another option is saving image file to disk with an opencv command, and opening it with Movie file In TOP. There is currently no option to create TOPs from numpyArrays which is suitable for realtime.

yeah that’s what I’m doing at the moment… movieinTOP and triggering the reload button. not really elegant though :wink: will also try rtsp, should be better when it comes to read/write access?

+1

It would be awesome to have this feature. I would love to get some deep learning going on in TD.

I too would be interested in this functionality. I’m on project 2 now where I’ve run into this issue! I can only assume there will be more.

+1
It would make a lot of sense :slight_smile:

any news on this?
moviefileinTOP method is a fastest way at the moment?

I’m also very much interested in this.

H̶e̶y̶ ̶D̶e̶r̶i̶v̶a̶t̶i̶v̶e̶,̶ ̶a̶n̶y̶ ̶n̶e̶w̶s̶ ̶o̶n̶ ̶t̶h̶i̶s̶?̶

I̶ ̶d̶o̶ ̶a̶ ̶l̶o̶t̶ ̶o̶f̶ ̶w̶o̶r̶k̶ ̶i̶n̶ ̶T̶D̶ ̶&̶ ̶O̶p̶e̶n̶C̶V̶ ̶a̶n̶d̶ ̶i̶t̶ ̶w̶o̶u̶l̶d̶ ̶s̶e̶r̶i̶o̶u̶s̶l̶y̶ ̶s̶p̶e̶e̶d̶ ̶u̶p̶ ̶m̶y̶ ̶w̶o̶r̶k̶ ̶i̶f̶ ̶I̶ ̶c̶o̶u̶l̶d̶ ̶j̶u̶s̶t̶ ̶w̶r̶i̶t̶e̶ ̶a̶ ̶P̶y̶t̶h̶o̶n̶ ̶n̶u̶m̶p̶y̶ ̶a̶r̶r̶a̶y̶ ̶d̶i̶r̶e̶c̶t̶l̶y̶ ̶t̶o̶ ̶a̶ ̶T̶O̶P̶
(̶w̶o̶u̶l̶d̶ ̶t̶h̶a̶t̶ ̶b̶e̶ ̶a̶ ̶P̶y̶t̶h̶o̶n̶ ̶T̶O̶P̶?̶)̶.̶ ̶T̶h̶i̶s̶ ̶w̶o̶u̶l̶d̶ ̶o̶p̶e̶n̶ ̶u̶p̶ ̶a̶ ̶w̶h̶o̶l̶e̶ ̶l̶o̶t̶ ̶o̶f̶ ̶n̶e̶w̶ ̶o̶p̶t̶i̶o̶n̶s̶ ̶f̶o̶r̶ ̶p̶e̶o̶p̶l̶e̶ ̶w̶o̶r̶k̶i̶n̶g̶ ̶i̶n̶ ̶M̶a̶c̶h̶i̶n̶e̶ ̶L̶e̶a̶r̶n̶i̶n̶g̶ ̶/̶ ̶r̶e̶a̶l̶t̶i̶m̶e̶ ̶O̶p̶e̶n̶C̶V̶.̶

I̶t̶ ̶a̶l̶s̶o̶ ̶s̶e̶e̶m̶s̶ ̶l̶i̶k̶e̶ ̶a̶ ̶n̶o̶t̶ ̶v̶e̶r̶y̶ ̶c̶o̶m̶p̶l̶i̶c̶a̶t̶e̶d̶ ̶f̶e̶a̶t̶u̶r̶e̶ ̶w̶h̶i̶c̶h̶ ̶h̶a̶s̶ ̶b̶e̶e̶n̶ ̶r̶e̶q̶u̶e̶s̶t̶e̶d̶ ̶b̶y̶ ̶q̶u̶i̶t̶e̶ ̶s̶o̶m̶e̶ ̶u̶s̶e̶r̶s̶ ̶f̶o̶r̶ ̶a̶ ̶w̶h̶i̶l̶e̶ ̶n̶o̶w̶,̶ ̶c̶a̶n̶ ̶y̶o̶u̶ ̶p̶l̶e̶a̶s̶e̶ ̶g̶i̶v̶e̶ ̶s̶o̶m̶e̶ ̶f̶e̶e̶d̶b̶a̶c̶k̶ ̶w̶h̶e̶r̶e̶ ̶t̶h̶i̶s̶ ̶i̶s̶ ̶o̶n̶ ̶t̶h̶e̶ ̶r̶o̶a̶d̶m̶a̶p̶?̶
T̶h̶a̶n̶k̶s̶!̶ ̶I̶d̶z̶a̶r̶d̶.̶

Script TOP has been added to official release ! :heart:

4 Likes

Finally exporting OpenCV processed Numpy array to TOP directly with Script TOP in the latest build😍

2 Likes

WOWOWOWOWOW!!! Thank you so much!