tiff图像的数据分析(VB版)_第1页
tiff图像的数据分析(VB版)_第2页
tiff图像的数据分析(VB版)_第3页
tiff图像的数据分析(VB版)_第4页
tiff图像的数据分析(VB版)_第5页
已阅读5页,还剩5页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、根据代码解释,详细讲解在代码后。先写一个如下的界面。基中 testlong,command5,test. 在这里没用。 提取数据按钮代码如下:Private Sub 提取数据 _Click(Dim filename As String 这里用来指定 tiff 文件的所在路径。绝对路径filename = "C:Documents and SettingsAdministrator桌面 1.tif"Open filename For Binary As #1 用二进制方法打开这个文件Dim aryContent( As Byte ' 用来读取文件的数组ReDim ar

2、yContent(3 定义 4个长度, 2个为数据格式, 2个为版本格式 Get #1, , aryContent( ' 取得第一文件的内容到数组 二个逗号之间为空,表明从头开始读数据,或者从上一次读完后的地方再读数据,读 到把数组装满后就不再读取,因此本次读了 4个字节的数据Dim version As Stringversion = "整数格式为:H" & hex(aryContent(0 & hex(aryContent(1 & Car(13 2个为数据格式version = version & "版本格式为:H&qu

3、ot; & Hex(aryContent(2 & Hex(aryContent(3 版本格式 以下为按需要读取其它信息的代码。根据偏移量。在代码后面会有详细解释Dim byte4( As ByteReDim byte4(CInt(Text3.Text 这里动态的定义数组的大小,根据需要也可以写成 clng(text3.textIf Text1.Text <= "0" Then Text1.Text = "1" 防止没有写。Get #1, CLng(Text1.Text, byte4(Dim i As IntegerFor i = 0

4、 To CInt(Text3.Text - 1version = version & "-" & Hex(byte4(iNext iText2.Text = version 在 Text2中显示出相关信息。Close #1 关闭End sub以我处理的文件为例。下面为读到的信息。先处理文件头信息:如表一表一 文件头信息IFH 结构描述-名称 字节数 数据类型 说明-Byteorder 2 Integer TIF 标记,其值为 4D4D 或 4949V ersion 2 Integer 版本号,其值恒为 2A00Offset to first IFD 4 Lo

5、ng 第一个 IFD 的偏移量从 1开始读取 2个长度的字节码,得到 :整数格式为:H7373版本格式为:H2A0-49-49 1-2 Byteorder :H49H49 2个字节 H4949时, 低字节在前, 高字节在后3-4 V ersion :H2AH0 2个字节5-8 Offset to firstIFD :H50611800第一个 IFD 的偏移量因为低字节在前,所以处理时反过来。 以后得到的数据都为 16进制,在处理时都要反 过来,把低字节放后,高字节放前。 H186150,十进制为 1597776,为偏移量偏移量为 1597776,但在 text1处要填 1597777。类似于一

6、开始时,偏移量为 0,但在那 里填 1。这里绕了几个小时,从 http:/www.awaresystems.be/imaging/tiff/tifftags/s earc h.html 下载一个 软件 installer0200.exe. 里面可以把一些基本信息读出来,类似于本篇文章的代码功能。 再处理第一个 IFD 信息。信息内容如表二表二 IFD 结构描述-名称 字节数 数据类型 说明-Directory Entry Count 2 Integer 本 IFD 中 DE 的数量Directory Entry(1 12 简称 DE ,中文译义“目录项”Directory Entry(2 12

7、Directory Entry(N 12Offset to next IFD 4 Long 下一个 IFD 的偏移量从 1597777开始读取 2个长度的字节码,得到。 。 。 。 。1597777-1597779 本 IFD 中 DE 的数量:H000F 2个字节 表明里面有 15个 DE DE 中的信息如表三:第一个 DE 中的信息 1597779-1597790 FE-0-4-0-1-0-0-0-0-0-0-01597779-1597780 标签编号 2个字节 为 HFE00,变为 00FE所以的标签编号信息如表四,在后面。1597781-1597782 数据类型 2个字节 为 H040

8、0, 变为 0004 4为 Long 型 1597783-1597786 该类型数据的数量 4个字节 为 H01000000变为 0-0-0-1数量为 1 1597787-1597790 属性值的存放偏移量 4个字节 0-0-0-0以下类似,处理数据时都反过来处理表三 DE 结构描述-名称 字节数 数据类型 说明-tag 2 Integer 本属性的标签编号type 2 Integer 本属性值的数据类型length 4 Long 该类型数据的数量valueOffset 4 Long 属性值的存放偏移量-(数据类型的信息,如表五表五 DE 中的数据类型-type 值 数据类型 说明-1 = B

9、YTE2 = ASCII3 = SHORT4 = LONG5 = RATIONAL分数类型,由两个 Long 组成,第 1个是分子,第 2个是分母6 = SBYTE7 = UNDEFINED8 = SSHORT9 = SLONG10 = SRATIONAL11 = FLOAT12 = DOUBLE第二个 DE 中的信息 1597791- 0-1-3-0-1-0-0-0-80-4-0-0标签编号 0100 ImageWidth数据类型 0003 3为 Integer 型该类型数据的数量 00000001 数量为 1属性值的存放偏移量 00000480 数量为 1152。 。 。 。 。以下类推第

10、十五个 DE 中的信息 1597947- 3D-1-3-0-1-0-0-0-1-0-0-0标签编号 013D Predictor数据类型 0003 3为 Integer 型该类型数据的数量 0001 为 1属性值的存放偏移量 0001 ? 34675 8773 ICC Profile ICC profile data. Used in interchangeable GeoTIFF files. Used in interchangeable GeoTIFF files. Used in interchangeable GeoTIFF files. A pointer to the Exif-

11、related GPS Info IFD. Used by HylaFAX. Used by HylaFAX. Used by HylaFAX. Used by Adobe Photoshop. A pointer to the Exif-related Interoperability IFD. Used by the GDAL library, holds an XML list of name=value 'metadata' values about the image as a whole, and about specific samples. Used by th

12、e GDAL library, contains an ASCII encoded nodata or background pixel value. Used in the Oce scanning process. Used in the Oce scanning process. Used in the Oce scanning process. 34735 87AF GeoKeyDirectoryTag 34736 87B0 GeoDoubleParamsTag 34737 87B1 GeoAsciiParamsTag 34853 8825 GPS IFD 34908 885C Hyl

13、aFAX FaxRecvParams 34909 885D HylaFAX FaxSubAddress 34910 885E HylaFAX FaxRecvTime 37724 935C ImageSourceData 40965 A005 Interoperability IFD 42112 A480 GDAL_METADATA 42113 A481 GDAL_NODATA 50215 C427 Oce Scanjob Description 50216 C428 Oce Application Selector 50217 C429 Oce Identification Number 50

14、218 C42A Oce ImageLogic Characteristics Used in the Oce scanning process. 50706 C612 DNGVersion 50707 C613 DNGBackwardVersion 50708 C614 UniqueCameraModel 50709 C615 LocalizedCameraModel 50710 C616 CFAPlaneColor 50711 C617 CFALayout 50712 C618 LinearizationTable 50713 C619 BlackLevelRepeatDim 50714

15、C61A BlackLevel 50715 C61B BlackLevelDeltaH 50716 C61C BlackLevelDeltaV Used in IFD 0 of DNG files. Used in IFD 0 of DNG files. Used in IFD 0 of DNG files. Used in IFD 0 of DNG files. Used in Raw IFD of DNG files. Used in Raw IFD of DNG files. Used in Raw IFD of DNG files. Used in Raw IFD of DNG fil

16、es. Used in Raw IFD of DNG files. Used in Raw IFD of DNG files. Used in Raw IFD of DNG files. 50717 C61D WhiteLevel 50718 C61E DefaultScale 50719 C61F DefaultCropOrigin 50720 C620 DefaultCropSize 50721 C621 ColorMatrix1 50722 C622 ColorMatrix2 50723 C623 CameraCalibration1 50724 C624 CameraCalibrati

17、on2 50725 C625 ReductionMatrix1 50726 C626 ReductionMatrix2 50727 C627 AnalogBalance 50728 C628 AsShotNeutral 50729 C629 AsShotWhiteXY 50730 C62A BaselineExposure 50731 C62B BaselineNoise 50732 C62C BaselineSharpness 50733 C62D BayerGreenSplit 50734 C62E LinearResponseLimit 50735 C62F CameraSerialNu

18、mber 50736 C630 LensInfo 50737 C631 ChromaBlurRadius 50738 C632 AntiAliasStrength 50740 C634 DNGPrivateData 50741 C635 MakerNoteSafety 50778 C65A CalibrationIlluminant1 50779 C65B CalibrationIlluminant2 50780 C65C BestQualityScale 50784 C660 Alias Layer Metadata Used in Raw IFD of DNG files. Used in Raw IFD of DNG files. Used in Raw IFD of DNG files. Used in Raw IFD of DNG files. Used in IFD 0 of DNG files. Used in IFD 0 of DNG files. Used in IFD 0 of DNG fi

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论