Login | Register 
FEATURES
APPLICATIONS
DOWNLOADS
EDUCATION
BLOG
WIKI
FORUM
STORE

numPy array to TOP?

General discussion about anything TouchDesigner

numPy array to TOP?

Postby yagodequay » Sun Jan 27, 2019 11:53 pm

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.
yagodequay
 
Posts: 40
Joined: Tue Mar 17, 2015 5:58 pm

Re: numPy array to TOP?

Postby ben » Wed Jan 30, 2019 5:15 pm

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.
User avatar
ben
Staff
 
Posts: 2393
Joined: Thu Nov 08, 2007 6:55 pm
Location: Toronto

Re: numPy array to TOP?

Postby yagodequay » Sun Feb 03, 2019 9:31 pm

Yes, because having a CHOP in the middle seems taxing. Looking forward!
yagodequay
 
Posts: 40
Joined: Tue Mar 17, 2015 5:58 pm

Re: numPy array to TOP?

Postby jmt4zj » Mon Feb 04, 2019 8:14 am

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.
Jonathan Thompson
@pointshader
http://pointshader.com
User avatar
jmt4zj
 
Posts: 116
Joined: Mon Nov 01, 2010 3:15 am
Location: NYC

Re: numPy array to TOP?

Postby akoenig » Thu Mar 14, 2019 12:06 pm

ben wrote: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 an RFE to make it easier.


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!
akoenig
 
Posts: 4
Joined: Tue Mar 20, 2012 1:01 pm

Re: numPy array to TOP?

Postby nettoyeur » Thu Mar 14, 2019 8:00 pm

there's also the Script CHOP. See example making a chop with info from a numpyarray on the OpenCV wiki page
Idzard Kwadijk | freelance TouchDesigner consultant | IdzArd.com
Checkout ChopChopChop.org - the TouchDesigner marketplace!
nettoyeur
 
Posts: 1049
Joined: Mon Oct 15, 2012 12:00 pm
Location: Amsterdam, The Netherlands

Re: numPy array to TOP?

Postby akoenig » Fri Mar 15, 2019 6:53 am

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.
akoenig
 
Posts: 4
Joined: Tue Mar 20, 2012 1:01 pm

Re: numPy array to TOP?

Postby nettoyeur » Fri Mar 15, 2019 2:33 pm

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.
Idzard Kwadijk | freelance TouchDesigner consultant | IdzArd.com
Checkout ChopChopChop.org - the TouchDesigner marketplace!
nettoyeur
 
Posts: 1049
Joined: Mon Oct 15, 2012 12:00 pm
Location: Amsterdam, The Netherlands

Re: numPy array to TOP?

Postby akoenig » Fri Mar 15, 2019 3:01 pm

yeah that's what I'm doing at the moment... movieinTOP and triggering the reload button. not really elegant though ;-) will also try rtsp, should be better when it comes to read/write access?
akoenig
 
Posts: 4
Joined: Tue Mar 20, 2012 1:01 pm


Return to General TouchDesigner Discussion

Who is online

Users browsing this forum: Bing [Bot] and 15 guests