Optimizing performance when reading a satellite image file in python -


I have a multiband satellite image stored in a band-embedded pixel (BIP) format with a different header file. The header file provides details such as the number of rows and columns in the image, and the number of bands (standard can be more than 3).

The image itself is stored like this 5 band image):

[B1] [B2] [B3] [B4] [B5] [B] 1] [B2] [B3] [B4] [B5] ... and so on (basically 5 bytes - one for each band - for each pixel starting from the upper left corner of the image).

I have to split these two bands into Python 3.2 as PIL images (on Windows 7 64 bit), and currently I think I am getting this problem wrong, my current The code is as follows:

  DEF OpenBIPImage (file, width, height, numberoff): Opens a raw image file in "BP format" and returns a list as each band Different PIL Image. "" Band Arrays = [] as an image file in the form of open (file, 'rb'): in the range for the data = imageFile.read () currentPosition = 0 (height * width): J in range (numberOfBands): If i == 0: bandArrays.append (byteearray (data [currentPosition: currentPosition + 1]) Other: Bandage [J]. Extension (data [current state: current position + 1]) currentPosition + = 1 band = [image in bandage "L", (width, height), bytes (bandar)) for bandage back band   

This code is too much for opening a Bip file It takes time, of course, there is a better way of doing this. I have an impossible and imbalanced library, but I'm not sure how I can use them, or if they can help in any way.

Since the number of bands in the image is too variable, I am finding it difficult to quickly read the file and remove a way to separate it in my component bands.

And for the sake of record, I have tried to mess with list methods (due to the number of iterations in the width * height * number of farands), loops (using slices, slides Do not use, using only append, expand etc.), this does not make any difference especially because the time is lost.

Any suggestion or advice will really be helpful thanks.

If you can get a fast function to load binary data in a large dragon list ( Or Numpy array), you can tweak the data using slicing notation:

  band0 = biglist [:: nbands] band1 = biglist [1 :: nbands] .... < / Code>  

Does that help?

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

c# - Confused over DLL entry points (entry point not found exception) -