MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Slow image import

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113008] Re: Slow image import
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sun, 10 Oct 2010 06:44:10 -0400 (EDT)

On 10/9/10 at 6:33 AM, todummy at gmail.com (to) wrote:

>I was trying to use Mathematica 7.0.1 for batch image processing.  I
>used the Import command to load 4000x2000 pixel tiff files.  Using
>the timing command, I noticed it takes about 0.95 second just to
>load the image !!!!  Using another system, I can do the same in
>about 0.15 s.  (about 6-7 x faster).

>Is there any way to speed things up ???  I already tried to first
>write the tiff image data as a raw binary file and loading it again.
>It still take about 0.7 seconds in that case.

The issue is the overhead associated with Import which spends
time determining details of the file format. If you know you
have raw binary data representing an image m pixels wide, it is
much faster to do

Partition[ReadBinaryList["image.dat","Integer32"],m]

Here, I've assumed the binary format is a 32 bit integer. If
this is not the case, substitute the correct binary format.
Also, you will need to pay attention to byte ordering.



  • Prev by Date: Re: Generation of polynomials
  • Next by Date: Re: Generation of polynomials
  • Previous by thread: Slow image import
  • Next by thread: Re: Slow image import