26.06.2013 Views

Étude des propriétés hydriques et des mécanismes d ... - sacre

Étude des propriétés hydriques et des mécanismes d ... - sacre

Étude des propriétés hydriques et des mécanismes d ... - sacre

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Annexes<br />

D : codage de la macro excel utilisée pour l’analyse d’image<br />

(macro codée par Xavier Laure, ingénieur-informaticien du CRMD)<br />

'doc sur le format BMP http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html#bmih<br />

Option Base 1<br />

Const StartBITMAPFILEHEADER = 1<br />

Const StartBITMAPINFOHEADER = 15<br />

Type BITMAPFILEHEADER<br />

bfType As Integer ' must always be s<strong>et</strong> to 'BM' to declare that this is a .bmp-file.<br />

bfSize As Long 'specifies the size of the file in bytes.<br />

bfReserved1 As Integer 'must always be s<strong>et</strong> to zero.<br />

bfReserved2 As Integer ' must always be s<strong>et</strong> to zero.<br />

bfOffBits As Long 'specifies the offs<strong>et</strong> from the beginning of the file to the bitmap data.<br />

End Type<br />

Type BITMAPINFOHEADER<br />

biSize As Long 'specifies the size of the BITMAPINFOHEADER structure, in bytes.<br />

biWidth As Long ' specifies the width of the image, in pixels.<br />

biHeight As Long 'specifies the height of the image, in pixels.<br />

biPlanes As Integer ' specifies the number of planes of the targ<strong>et</strong> device, must be s<strong>et</strong> to zero.<br />

biBitCount As Integer ' specifies the number of bits per pixel.<br />

biCompression As Long ' Specifies the type of compression, usually s<strong>et</strong> to zero (no compression).<br />

biSizeImage As Long ' specifies the size of the image data, in bytes. If there is no compression, it is valid to<br />

s<strong>et</strong> this member to zero.<br />

biXPelsPerM<strong>et</strong>er As Long ' specifies the the horizontal pixels per m<strong>et</strong>er on the <strong>des</strong>ignated targer device,<br />

usually s<strong>et</strong> to zero.<br />

biYPelsPerM<strong>et</strong>er As Long ' specifies the the vertical pixels per m<strong>et</strong>er on the <strong>des</strong>ignated targer device,<br />

usually s<strong>et</strong> to zero.<br />

biClrUsed As Long ' specifies the number of colors used in the bitmap, if s<strong>et</strong> to zero the number of colors is<br />

calculated using the biBitCount member.<br />

biClrImportant As Long ' specifies the number of color that are 'important' for the bitmap, if s<strong>et</strong> to zero, all<br />

colors are important.<br />

End Type<br />

Type Pixel 'les couleurs sont placées dans le sens BVR car dans le fichier le stockage du RVB est inversé<br />

Bleu As Byte<br />

Vert As Byte<br />

Rouge As Byte<br />

End Type<br />

Dim Image() As Byte 'image mémoire du .BMP<br />

Dim Histo(256) As Integer<br />

Sub normal()<br />

Cells.Select<br />

Selection.ColumnWidth = 10<br />

Selection.RowHeight = 20<br />

End Sub<br />

Sub afficheBMP()<br />

Dim InfoFile As BITMAPFILEHEADER<br />

Dim InfoBMP As BITMAPINFOHEADER<br />

Dim Pix As Pixel<br />

Dim IndexLecture As Long<br />

Dim ValSeuilR As Byte, ValSeuilV As Byte, ValSeuilB As Byte<br />

'préparation de la feuille<br />

Cells.Select<br />

Selection.ColumnWidth = 0.1<br />

Selection.RowHeight = 1<br />

Open "c:\temp\test1.bmp" For Binary Access Read As #1<br />

G<strong>et</strong> #1, StartBITMAPFILEHEADER, InfoFile<br />

G<strong>et</strong> #1, StartBITMAPINFOHEADER, InfoBMP<br />

' test de la validité du fichier<br />

Kévin Beck (2006) 221

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!