Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93541
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Subject | Re: Fast capture and 2D image stacking as 3D numpy array with Python and Raspberry Pi |
| Date | 2015-07-06 22:59 +0100 |
| References | <161f3646-9739-4c14-af41-b07498a83d26@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.332.1436220007.3674.python-list@python.org> (permalink) |
On 06/07/2015 22:31, Agustin Cruz wrote:
> I'm working on a Python - Raspberry Pi project in which I need to take about 30 images per second (no movie) and stack each 2D image to a 3D array using numpy array, without saving each 2D capture as a file (because is slow).
>
> I found this Python code to take images as fast as possible, but i don't know how to stack all images fast to a 3D stack of images.
>
> import io
> import time
> import picamera
> #from PIL import Image
>
> def outputs():
> stream = io.BytesIO()
> for i in range(40):
> # This returns the stream for the camera to capture to
> yield stream
> # Once the capture is complete, the loop continues here
> # (read up on generator functions in Python to understand
> # the yield statement). Here you could do some processing
> # on the image...
> #stream.seek(0)
> #img = Image.open(stream)
> # Finally, reset the stream for the next capture
> stream.seek(0)
> stream.truncate()
>
> with picamera.PiCamera() as camera:
> camera.resolution = (640, 480)
> camera.framerate = 80
> time.sleep(2)
> start = time.time()
> camera.capture_sequence(outputs(), 'jpeg', use_video_port=True)
> finish = time.time()
> print('Captured 40 images at %.2ffps' % (40 / (finish - start)))
>
> Does anyone of you know how to stack the 2D images taken in this code to a 3D numpy array using Python and the Raspberry Pi camera module? Without saving each 2D capture as a file
>
> Best regards, AgustÃn
>
http://docs.scipy.org/doc/numpy/reference/generated/numpy.dstack.html is
the first hit on google for "numpy 3d array stack".
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Fast capture and 2D image stacking as 3D numpy array with Python and Raspberry Pi Agustin Cruz <agustin.cruz@gmail.com> - 2015-07-06 14:31 -0700
Re: Fast capture and 2D image stacking as 3D numpy array with Python and Raspberry Pi Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-06 22:59 +0100
Re: Fast capture and 2D image stacking as 3D numpy array with Python and Raspberry Pi Agustin Cruz <agustin.cruz@gmail.com> - 2015-07-06 16:16 -0700
Re: Fast capture and 2D image stacking as 3D numpy array with Python and Raspberry Pi Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-07 07:49 +0100
csiph-web