收藏 分销(赏)

tiff图像的数据分析(VB版).doc

上传人:二*** 文档编号:4542352 上传时间:2024-09-27 格式:DOC 页数:28 大小:336KB
下载 相关 举报
tiff图像的数据分析(VB版).doc_第1页
第1页 / 共28页
亲,该文档总共28页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

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 aryContent(3) 定义4个长度,2个

2、为数据格式,2个为版本格式Get #1, , aryContent() 取得第一文件的内容到数组二个逗号之间为空,表明从头开始读数据,或者从上一次读完后的地方再读数据,读到把数组装满后就不再读取,因此本次读了4个字节的数据Dim version As Stringversion = 整数格式为:H & hex(aryContent(0) & hex(aryContent(1) & Car(13) 2个为数据格式version = version & 版本格式为:H & Hex(aryContent(2) & Hex(aryContent(3) 版本格式以下为按需要读取其它信息的代码。根据偏移量

3、。在代码后面会有详细解释 Dim byte4() As ByteReDim byte4(CInt(Text3.Text)这里动态的定义数组的大小,根据需要也可以写成clng(text3.text) If Text1.Text = 0 Then Text1.Text = 1防止没有写。Get #1, CLng(Text1.Text), byte4() Dim i As Integer For i = 0 To CInt(Text3.Text - 1) version = version & - & Hex(byte4(i) Next i Text2.Text = version 在Text2中显

4、示出相关信息。 Close #1 关闭End sub以我处理的文件为例。下面为读到的信息。先处理文件头信息:如表一表一 文件头信息IFH结构描述-名称字节数数据类型 说明-Byteorder 2 Integer TIF标记,其值为4D4D或4949Version 2 Integer 版本号,其值恒为2A00Offset to first IFD 4 Long 第一个IFD的偏移量从1开始读取2个长度的字节码,得到:整数格式为:H7373版本格式为:H2A0-49-491-2Byteorder :H49H492个字节 H4949时,低字节在前,高字节在后3-4Version :H2AH0 2个字

5、节5-8Offset to firstIFD:H50611800第一个IFD的偏移量因为低字节在前,所以处理时反过来。以后得到的数据都为16进制,在处理时都要反过来,把低字节放后,高字节放前。H186150,十进制为1597776,为偏移量偏移量为1597776,但在text1处要填1597777。类似于一开始时,偏移量为0,但在那里填1。这里绕了几个小时,从http:/www.awaresystems.be/imaging/tiff/tifftags/search.html下载一个软件installer0200.exe.里面可以把一些基本信息读出来,类似于本篇文章的代码功能。再处理第一个IF

6、D信息。信息内容如表二表二 IFD结构描述-名称字节数数据类型 说明-Directory Entry Count 2 Integer 本IFD中DE的数量Directory Entry(1) 12 简称DE,中文译义“目录项”Directory Entry(2) 12Directory Entry(N) 12Offset to next IFD 4 Long 下一个IFD的偏移量从1597777开始读取2个长度的字节码,得到。1597777-1597779 本IFD中DE的数量:H000F 2个字节 表明里面有15个DEDE中的信息如表三:第一个DE中的信息1597779-1597790 FE

7、-0-4-0-1-0-0-0-0-0-0-01597779-1597780 标签编号 2个字节 为HFE00,变为00FE 所以的标签编号信息如表四,在后面。1597781-1597782 数据类型 2个字节 为H0400,变为0004 4为Long型1597783-1597786 该类型数据的数量 4个字节 为H01000000变为 0-0-0-1数量为11597787-1597790 属性值的存放偏移量4个字节 0-0-0-0 以下类似,处理数据时都反过来处理 表三 DE结构描述-名称字节数数据类型 说明-tag 2 Integer 本属性的标签编号type 2 Integer 本属性值的

8、数据类型length 4 Long 该类型数据的数量valueOffset 4 Long 属性值的存放偏移量-(数据类型的信息,如表五)表五DE中的数据类型-type值数据类型 说明- 1 = BYTE 2= ASCII 3 = SHORT 4 = LONG 5 = RATIONAL分数类型,由两个Long组成,第1个是分子,第2个是分母6 = SBYTE 7 = UNDEFINED 8 = SSHORT 9 = SLONG 10= SRATIONAL 11= FLOAT 12= DOUBLE 第二个DE中的信息1597791- 0-1-3-0-1-0-0-0-80-4-0-0标签编号 010

9、0ImageWidth数据类型 00033为Integer型该类型数据的数量 00000001 数量为1属性值的存放偏移量 00000480 数量为1152。以下类推第十五个DE中的信息1597947- 3D-1-3-0-1-0-0-0-1-0-0-0标签编号 013DPredictor数据类型 00033为Integer型该类型数据的数量 0001 为1属性值的存放偏移量 0001?表四 标签编号CodeNameShort descriptionDecHex25400FENewSubfileTypeA general indication of the kind of data contai

10、ned in this subfile.25500FFSubfileTypeA general indication of the kind of data contained in this subfile.2560100ImageWidthThe number of columns in the image, i.e., the number of pixels per row.2570101ImageLengthThe number of rows of pixels in the image.2580102BitsPerSampleNumber of bits per componen

11、t.2590103CompressionCompression scheme used on the image data.2620106PhotometricInterpretationThe color space of the image data.2630107ThreshholdingFor black and white TIFF files that represent shades of gray, the technique used to convert from gray to black and white pixels.2640108CellWidthThe widt

12、h of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file.2650109CellLengthThe length of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file.266010AFillOrderThe logical order of bits within a byte.270010EImageDescriptionA string th

13、at describes the subject of the image.271010FMakeThe scanner manufacturer.2720110ModelThe scanner model name or number.2730111StripOffsetsFor each strip, the byte offset of that strip.2740112OrientationThe orientation of the image with respect to the rows and columns.2770115SamplesPerPixelThe number

14、 of components per pixel.2780116RowsPerStripThe number of rows per strip.2790117StripByteCountsFor each strip, the number of bytes in the strip after compression.2800118MinSampleValueThe minimum component value used.2810119MaxSampleValueThe maximum component value used.282011AXResolutionThe number o

15、f pixels per ResolutionUnit in the ImageWidth direction.283011BYResolutionThe number of pixels per ResolutionUnit in the ImageLength direction.284011CPlanarConfigurationHow the components of each pixel are stored.2880120FreeOffsetsFor each string of contiguous unused bytes in a TIFF file, the byte o

16、ffset of the string.2890121FreeByteCountsFor each string of contiguous unused bytes in a TIFF file, the number of bytes in the string.2900122GrayResponseUnitThe precision of the information contained in the GrayResponseCurve.2910123GrayResponseCurveFor grayscale data, the optical density of each pos

17、sible pixel value.2960128ResolutionUnitThe unit of measurement for XResolution and YResolution.3050131SoftwareName and version number of the software package(s) used to create the image.3060132DateTimeDate and time of image creation.315013BArtistPerson who created the image.316013CHostComputerThe co

18、mputer and/or operating system in use at the time of image creation.3200140ColorMapA color map for palette color images.3380152ExtraSamplesDescription of extra components.334328298CopyrightCopyright notice.269010DDocumentNameThe name of the document from which this image was scanned.285011DPageNameT

19、he name of the page from which this image was scanned.286011EXPositionX position of the image.287011FYPositionY position of the image.2920124T4OptionsOptions for Group 3 Fax compression2930125T6OptionsOptions for Group 4 Fax compression2970129PageNumberThe page number of the page from which this ima

20、ge was scanned.301012DTransferFunctionDescribes a transfer function for the image in tabular style.317013DPredictorA mathematical operator that is applied to the image data before an encoding scheme is applied.318013EWhitePointThe chromaticity of the white point of the image.319013FPrimaryChromatici

21、tiesThe chromaticities of the primaries of the image.3210141HalftoneHintsConveys to the halftone function the range of gray levels within a colorimetrically-specified image that should retain tonal detail.3220142TileWidthThe tile width in pixels. This is the number of columns in each tile.3230143Til

22、eLengthThe tile length (height) in pixels. This is the number of rows in each tile.3240144TileOffsetsFor each tile, the byte offset of that tile, as compressed and stored on disk.3250145TileByteCountsFor each tile, the number of (compressed) bytes in that tile.3260146BadFaxLinesUsed in the TIFF-F st

23、andard, denotes the number of bad scan lines encountered by the facsimile device.3270147CleanFaxDataUsed in the TIFF-F standard, indicates if bad lines encountered during reception are stored in the data, or if bad lines have been replaced by the receiver.3280148ConsecutiveBadFaxLinesUsed in the TIF

24、F-F standard, denotes the maximum number of consecutive bad scanlines received.330014ASubIFDsOffset to child IFDs.332014CInkSetThe set of inks used in a separated (PhotometricInterpretation=5) image.333014DInkNamesThe name of each ink used in a separated image.334014ENumberOfInksThe number of inks.3

25、360150DotRangeThe component values that correspond to a 0% dot and 100% dot.3370151TargetPrinterA description of the printing environment for which this separation is intended.3390153SampleFormatSpecifies how to interpret each data sample in a pixel.3400154SMinSampleValueSpecifies the minimum sample

26、 value.3410155SMaxSampleValueSpecifies the maximum sample value.3420156TransferRangeExpands the range of the TransferFunction.3430157ClipPathMirrors the essentials of PostScripts path creation functionality.3440158XClipPathUnitsThe number of units that span the width of the image, in terms of intege

27、r ClipPath coordinates.3450159YClipPathUnitsThe number of units that span the height of the image, in terms of integer ClipPath coordinates.346015AIndexedAims to broaden the support for indexed images to include support for any color space.347015BJPEGTablesJPEG quantization and/or Huffman tables.351

28、015FOPIProxyOPI-related.4000190GlobalParametersIFDUsed in the TIFF-FX standard to point to an IFD containing tags that are globally applicable to the complete TIFF file.4010191ProfileTypeUsed in the TIFF-FX standard, denotes the type of data stored in this file or IFD.4020192FaxProfileUsed in the TI

29、FF-FX standard, denotes the profile that applies to this file.4030193CodingMethodsUsed in the TIFF-FX standard, indicates which coding methods are used in the file.4040194VersionYearUsed in the TIFF-FX standard, denotes the year of the standard specified by the FaxProfile field.4050195ModeNumberUsed

30、 in the TIFF-FX standard, denotes the mode of the standard specified by the FaxProfile field.43301B1DecodeUsed in the TIFF-F and TIFF-FX standards, holds information about the ITULAB (PhotometricInterpretation = 10) encoding.43401B2DefaultImageColorDefined in the Mixed Raster Content part of RFC 230

31、1, is the default color needed in areas where no image is available.5120200JPEGProcOld-style JPEG compression field. TechNote2 invalidates this part of the specification.5130201JPEGInterchangeFormatOld-style JPEG compression field. TechNote2 invalidates this part of the specification.5140202JPEGInte

32、rchangeFormatLengthOld-style JPEG compression field. TechNote2 invalidates this part of the specification.5150203JPEGRestartIntervalOld-style JPEG compression field. TechNote2 invalidates this part of the specification.5170205JPEGLosslessPredictorsOld-style JPEG compression field. TechNote2 invalida

33、tes this part of the specification.5180206JPEGPointTransformsOld-style JPEG compression field. TechNote2 invalidates this part of the specification.5190207JPEGQTablesOld-style JPEG compression field. TechNote2 invalidates this part of the specification.5200208JPEGDCTablesOld-style JPEG compression f

34、ield. TechNote2 invalidates this part of the specification.5210209JPEGACTablesOld-style JPEG compression field. TechNote2 invalidates this part of the specification.5290211YCbCrCoefficientsThe transformation from RGB to YCbCr image data.5300212YCbCrSubSamplingSpecifies the subsampling factors used f

35、or the chrominance components of a YCbCr image.5310213YCbCrPositioningSpecifies the positioning of subsampled chrominance components relative to luminance samples.5320214ReferenceBlackWhiteSpecifies a pair of headroom and footroom image data values (codes) for each pixel component.559022FStripRowCou

36、ntsDefined in the Mixed Raster Content part of RFC 2301, used to replace RowsPerStrip for IFDs with variable-sized strips.70002BCXMPXML packet containing XMP metadata32781800DImageIDOPI-related.3473287ACImageLayerDefined in the Mixed Raster Content part of RFC 2301, used to denote the particular fun

37、ction of this Image in the mixed raster scheme.3293280A4Wang AnnotationAnnotation data, as used in Imaging for Windows.3344582A5MD FileTagSpecifies the pixel data format encoding in the Molecular Dynamics GEL file format.3344682A6MD ScalePixelSpecifies a scale factor in the Molecular Dynamics GEL fi

38、le format.3344782A7MD ColorTableUsed to specify the conversion from 16bit to 8bit in the Molecular Dynamics GEL file format.3344882A8MD LabNameName of the lab that scanned this file, as used in the Molecular Dynamics GEL file format.3344982A9MD SampleInfoInformation about the sample, as used in the

39、Molecular Dynamics GEL file format.3345082AAMD PrepDateDate the sample was prepared, as used in the Molecular Dynamics GEL file format.3345182ABMD PrepTimeTime the sample was prepared, as used in the Molecular Dynamics GEL file format.3345282ACMD FileUnitsUnits for data in this file, as used in the

40、Molecular Dynamics GEL file format.33550830EModelPixelScaleTagUsed in interchangeable GeoTIFF files.3372383BBIPTCIPTC (International Press Telecommunications Council) metadata.33918847EINGR Packet Data TagIntergraph Application specific storage.33919847FINGR Flag RegistersIntergraph Application spec

41、ific flags.339208480IrasB Transformation MatrixOriginally part of Intergraphs GeoTIFF tags, but likely understood by IrasB only.339228482ModelTiepointTagOriginally part of Intergraphs GeoTIFF tags, but now used in interchangeable GeoTIFF files.3426485D8ModelTransformationTagUsed in interchangeable G

42、eoTIFF files.343778649PhotoshopCollection of Photoshop Image Resource Blocks.346658769Exif IFDA pointer to the Exif IFD.346758773ICC ProfileICC profile data.3473587AFGeoKeyDirectoryTagUsed in interchangeable GeoTIFF files.3473687B0GeoDoubleParamsTagUsed in interchangeable GeoTIFF files.3473787B1GeoAsciiParamsTagUsed in interchangeable GeoTIFF files.348538825GPS IFDA pointer to the Exif-related GPS Info IFD.34908885CHylaFAX FaxRecvParamsUsed by

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 通信科技 > 数据库/数据算法

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服