Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #93541

Re: Fast capture and 2D image stacking as 3D numpy array with Python and Raspberry Pi

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!border2.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.05; 'from:addr:yahoo.co.uk': 0.05; 'pil': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'stack': 0.13; 'def': 0.13; 'subject: \n ': 0.15; '(read': 0.16; 'cruz': 0.16; 'module?': 0.16; 'numpy': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:array': 0.16; 'subject:image': 0.16; 'time.time()': 0.16; 'wrote:': 0.16; 'language': 0.19; 'complete,': 0.22; 'lawrence': 0.22; 'second': 0.24; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'skip:# 10': 0.27; 'finally,': 0.27; 'yield': 0.27; 'skip:u 20': 0.28; 'array': 0.29; 'reset': 0.29; "i'm": 0.30; 'code': 0.30; 'anyone': 0.32; 'language.': 0.32; 'stream': 0.33; 'file': 0.34; 'skip:c 30': 0.35; 'next': 0.35; 'could': 0.35; 'possible,': 0.35; 'but': 0.36; 'project': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'google': 0.39; 'does': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'subject:with': 0.40; 'some': 0.40; 'per': 0.62; 'charset:windows-1252': 0.62; 'our': 0.64; 'capture': 0.66; 'here': 0.66; 'saving': 0.70; 'agustin': 0.84; 'pythonistas,': 0.84; 'received:as9105.com': 0.84; 'received:dsl.as9105.com': 0.84; 'received:dynamic.dsl.as9105.com': 0.84; 'subject:Fast': 0.84; 'url:scipy': 0.84; 'url:reference': 0.91; 'camera': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
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 Mon, 06 Jul 2015 22:59:53 +0100
References <161f3646-9739-4c14-af41-b07498a83d26@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host 80-44-197-9.dynamic.dsl.as9105.com
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
In-Reply-To <161f3646-9739-4c14-af41-b07498a83d26@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.332.1436220007.3674.python-list@python.org> (permalink)
Lines 48
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1436220007 news.xs4all.nl 2964 [2001:888:2000:d::a6]:43958
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:93541

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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