Replies: 1 comment 6 replies
-
Yes, it is a Py5Image object. Is there documentation somewhere that says PImage? I can't find any.
Why not? Sounds like a great idea to me. Let's add it!
Yes, but that's already happening when users use Right now one could do the following to get a section of the pixels as a numpy array: py5.load_np_pixels()
array = py5.np_pixels[10:50, 10:50, :] A new In [2]: numbers = np.random.rand(5)
In [3]: numbers
Out[3]: array([0.02467264, 0.73513364, 0.8310362 , 0.90134441, 0.57971202])
In [4]: view1 = numbers[2:4]
In [5]: copy1 = numbers[2:4].copy()
In [6]: numbers[3] = 42
In [7]: view1
Out[7]: array([ 0.8310362, 42. ])
In [8]: copy1
Out[8]: array([0.8310362 , 0.90134441]) I think including a |
Beta Was this translation helpful? Give feedback.
-
We have
get_pixels()
that can get us a single pixel or a PImage (should it be a Py5Image?) area of pixels. Could we get a np_array quickly without having to do theload_np_pixels()
thing before using.np_pixels[]
etc.? Would it make sense?I suppose there could be a performance penalty for calling load_np_pixels every time...
Beta Was this translation helpful? Give feedback.
All reactions