callbacks: Modified callbacks example to use coords with modification.
This commit is contained in:
@ -77,7 +77,9 @@ class pytorch_function_display_callback(object): # NOSONAR
|
||||
>>> img = np.zeros((300, 300, 3))
|
||||
>>> def fun(array, coords, finished):
|
||||
... rgb = torch.empty(array.shape).uniform_(0,1).type(torch.DoubleTensor).to(array.device)/150.0
|
||||
... array[coords] = (array[coords+np.ones_like(coords)] + rgb[coords])%1.0
|
||||
... trans = np.zeros_like(coords)
|
||||
... trans[0,...] = 1
|
||||
... array[coords] = (array[coords+trans] + rgb[coords])%1.0
|
||||
>>> VideoHandlerThread(video_source=img, callbacks=pytorch_function_display_callback(fun)).display()
|
||||
|
||||
thanks: https://medium.com/@awildtaber/building-a-rendering-engine-in-tensorflow-262438b2e062
|
||||
|
Reference in New Issue
Block a user