GDAL库三个读取Jpeg2000格式驱动测试


0、目的

GDAL库中提供了四五种读取Jpeg2000的驱动,但是各个驱动读取数据的效率各不相同,下面就针对三种读取jpeg2000的效率进行测试。
GDAL库中提供的读取Jpeg2000的驱动有下面六个,具体的说明请移步GDAL官网查看。地址为:http://www.gdal.org/formats_list.html

  1. JPEG2000 — Implementation of the JPEG-2000 part 1
  2. JP2ECW – ERDAS JPEG2000 (.jp2)
  3. JP2KAK – JPEG-2000 (based on Kakadu)
  4. JP2OpenJPEG — JPEG2000 driver based on OpenJPEG library
  5. JPIPKAK – JPIP Streaming
    以上的所有的库默认编译都是没有的,都需要第三方库的支持,由于我只找到了1、2、4,所以就对这三种的读取效率进行测试。

1、 测试方式

使用一个全球1km的DEM数据(globaldem2.jp2)进行测试,经过Jpeg2000压缩后的大小为52MB。使用的测试工具为gdalinfo,为了能够体现数据读取的效率,添加了-checksum来计算图像的检验码,并且为了防止显示的内容过多而禁止输出元数据和栅格属性表内容。在测试的过程中,需要将另外的驱动进行禁用,这里使用CPL_SKIP进行设置。具体代码如下,同时为了能够显示处理时间,增加了输出时间的命令:

echo  %date% %time%
gdalinfo.exe -checksum -nomd -norat globaldem2.jp2 --config CPL_SKIP "JP2ECW JP2OpenJPEG"
echo  %date% %time%

2、测试步骤

2.1、检查驱动

使用gdalinfo.exe –formats输出支持的驱动,检查是否能够正常加载上述三种驱动。输出的内容如下,为了便于查找,我在三种Jpeg2000的驱动结尾加了****进行标识。

F:\RsSrcDir\binX64>gdalinfo.exe --formats
Supported Formats:
  ECW (rov): ERDAS Compressed Wavelets (SDK 4.2)
  JP2ECW (rov): ERDAS JPEG2000 (SDK 4.2) ******
  HDF4 (ros): Hierarchical Data Format Release 4
  HDF4Image (rw+): HDF4 Dataset
  HDF5 (ros): Hierarchical Data Format Release 5
  HDF5Image (ro): HDF5 Dataset
  MG4Lidar (ro): MrSID Generation 4 / Lidar (.sid)
  MrSID (rov): Multi-resolution Seamless Image Database (MrSID)
  JP2MrSID (rov): MrSID JPEG2000
  netCDF (rw+s): Network Common Data Format
  GMT (rw): GMT NetCDF Grid Format
  VRT (rw+v): Virtual Raster
  GTiff (rw+vs): GeoTIFF
  NITF (rw+vs): National Imagery Transmission Format
  RPFTOC (rovs): Raster Product Format TOC format
  ECRGTOC (rovs): ECRG TOC format
  HFA (rw+v): Erdas Imagine Images (.img)
  SAR_CEOS (rov): CEOS SAR Image
  CEOS (rov): CEOS Image
  JAXAPALSAR (rov): JAXA PALSAR Product Reader (Level 1.1/1.5)
  GFF (rov): Ground-based SAR Applications Testbed File Format (.gff)
  ELAS (rw+v): ELAS
  AIG (rov): Arc/Info Binary Grid
  AAIGrid (rwv): Arc/Info ASCII Grid
  GRASSASCIIGrid (rov): GRASS ASCII Grid
  SDTS (rov): SDTS Raster
  DTED (rwv): DTED Elevation Raster
  PNG (rwv): Portable Network Graphics
  JPEG (rwv): JPEG JFIF
  MEM (rw+): In Memory Raster
  JDEM (rov): Japanese DEM (.mem)
  GIF (rwv): Graphics Interchange Format (.gif)
  BIGGIF (rov): Graphics Interchange Format (.gif)
  ESAT (rov): Envisat Image Format
  FITS (rw+): Flexible Image Transport System
  BSB (rov): Maptech BSB Nautical Charts
  XPM (rwv): X11 PixMap Format
  BMP (rw+v): MS Windows Device Independent Bitmap
  DIMAP (rov): SPOT DIMAP
  AirSAR (ro): AirSAR Polarimetric Image
  RS2 (ros): RadarSat 2 XML Product
  PCIDSK (rw+v): PCIDSK Database File
  PCRaster (rw): PCRaster Raster File
  ILWIS (rw+v): ILWIS Raster Map
  SGI (rw+): SGI Image File Format 1.0
  SRTMHGT (rwv): SRTMHGT File Format
  Leveller (rw+): Leveller heightfield
  Terragen (rw+): Terragen heightfield
  ISIS3 (rov): USGS Astrogeology ISIS cube (Version 3)
  ISIS2 (rw+v): USGS Astrogeology ISIS cube (Version 2)
  PDS (rov): NASA Planetary Data System
  TIL (rov): EarthWatch .TIL
  ERS (rw+v): ERMapper .ers Labelled
  JP2OpenJPEG (rwv): JPEG-2000 driver based on OpenJPEG library******
  L1B (rovs): NOAA Polar Orbiter Level 1b Data Set
  FIT (rwv): FIT Image
  GRIB (rov): GRIdded Binary (.grb)
  JPEG2000 (rwv): JPEG-2000 part 1 (ISO/IEC 15444-1)******
  RMF (rw+v): Raster Matrix Format
  WCS (rovs): OGC Web Coverage Service
  WMS (rwvs): OGC Web Map Service
  MSGN (ro): EUMETSAT Archive native (.nat)
  RST (rw+v): Idrisi Raster A.1
  INGR (rw+v): Intergraph Raster
  GSAG (rwv): Golden Software ASCII Grid (.grd)
  GSBG (rw+v): Golden Software Binary Grid (.grd)
  GS7BG (rw+v): Golden Software 7 Binary Grid (.grd)
  COSAR (ro): COSAR Annotated Binary Matrix (TerraSAR-X)
  TSX (rov): TerraSAR-X Product
  COASP (ro): DRDC COASP SAR Processor Raster
  R (rwv): R Object Data Store
  MAP (rov): OziExplorer .MAP
  PNM (rw+v): Portable Pixmap Format (netpbm)
  DOQ1 (rov): USGS DOQ (Old Style)
  DOQ2 (rov): USGS DOQ (New Style)
  ENVI (rw+v): ENVI .hdr Labelled
  EHdr (rw+v): ESRI .hdr Labelled
  GenBin (rov): Generic Binary (.hdr Labelled)
  PAux (rw+): PCI .aux Labelled
  MFF (rw+): Vexcel MFF Raster
  MFF2 (rw+): Vexcel MFF2 (HKV) Raster
  FujiBAS (ro): Fuji BAS Scanner Image
  GSC (rov): GSC Geogrid
  FAST (rov): EOSAT FAST Format
  BT (rw+v): VTP .bt (Binary Terrain) 1.3 Format
  LAN (rw+v): Erdas .LAN/.GIS
  CPG (ro): Convair PolGASP
  IDA (rw+): Image Data and Analysis
  NDF (rov): NLAPS Data Format
  EIR (rov): Erdas Imagine Raw
  DIPEx (rov): DIPEx
  LCP (rwv): FARSITE v.4 Landscape File (.lcp)
  GTX (rw+v): NOAA Vertical Datum .GTX
  LOSLAS (rov): NADCON .los/.las Datum Grid Shift
  NTv2 (rw+vs): NTv2 Datum Grid Shift
  CTable2 (rw+v): CTable2 Datum Grid Shift
  ACE2 (rov): ACE2
  SNODAS (rov): Snow Data Assimilation System
  KRO (rw+v): KOLOR Raw
  ARG (rwv): Azavea Raster Grid format
  RIK (ro): Swedish Grid RIK (.rik)
  USGSDEM (rwv): USGS Optional ASCII DEM (and CDED)
  GXF (ro): GeoSoft Grid Exchange Format
  HTTP (ro): HTTP Fetching Wrapper
  NWT_GRD (rov): Northwood Numeric Grid Format .grd/.tab
  NWT_GRC (rov): Northwood Classified Grid Format .grc/.tab
  ADRG (rw+vs): ARC Digitized Raster Graphics
  SRP (rovs): Standard Raster Product (ASRP/USRP)
  BLX (rw): Magellan topo (.blx)
  Rasterlite (rws): Rasterlite
  SAGA (rw+v): SAGA GIS Binary Grid (.sdat)
  KMLSUPEROVERLAY (rwv): Kml Super Overlay
  XYZ (rwv): ASCII Gridded XYZ
  HF2 (rwv): HF2/HFZ heightfield raster
  PDF (rw): Geospatial PDF
  OZI (rov): OziExplorer Image File
  CTG (rov): USGS LULC Composite Theme Grid
  E00GRID (rov): Arc/Info Export E00 GRID
  ZMap (rwv): ZMap Plus Grid
  NGSGEOID (rov): NOAA NGS Geoid Height Grids
  MBTiles (rov): MBTiles
  21At MBTiles (rov): 21At MBTiles
  IRIS (rov): IRIS data (.PPI, .CAPPi etc)
  WMTS (rwv): OGC Web Mab Tile Service
  CNSDTF (rwv): China Geospatial Data Transfer Grid Format (.grd)
  LANDSAT (rov): LANDSAT 7/8 GeoTiff with Metadata

2.2、测试JPEG2000 — Implementation of the JPEG-2000 part 1

使用上面的代码,需要先将另外两种驱动禁用,整个批处理的代码如下:

echo  %date% %time%
gdalinfo.exe -checksum -nomd -norat globaldem2.jp2 --config CPL_SKIP "JP2ECW JP2OpenJPEG"
echo  %date% %time%

处理截图如图1所示:
JPEG2000处理耗时

2.3、测试JP2ECW – ERDAS JPEG2000 (.jp2)

修改上面的代码,禁用其他两种驱动,整个批处理的代码如下

echo  %date% %time%
gdalinfo.exe -checksum -nomd -norat globaldem2.jp2 --config CPL_SKIP "JPEG2000 JP2OpenJPEG"
echo  %date% %time%

处理截图如图2所示:
JP2ECW

2.4、测试JP2OpenJPEG — JPEG2000 driver based on OpenJPEG library

修改上面的代码,禁用其他两种驱动,整个批处理的代码如下:

echo  %date% %time%
gdalinfo.exe -checksum -nomd -norat globaldem2.jp2 --config CPL_SKIP "JP2ECW JP2OpenJPEG"
echo  %date% %time%

处理截图如图3所示:
JP2OpenJPEG
通过上面的测试发现,上述三个驱动均可以读取到图像的大小,空间参考等信息,前两种读取成功,第三种读取图像像素值的时候失败(今天在别的电脑测试可以读取成功,耗时非常大,本来这篇博客想比较这个库的处理速度的,结果在自己的电脑居然读取失败…………)。
还有一个就是ECW库读取的时候内存占用很少,而另外两个基本上内存有多少就占用多少,我使用的64bit的系统,8GB内存,这两个驱动处理的时候基本内存在5.5GB左右。

转载自:https://blog.csdn.net/liminlu0314/article/details/46991067

You may also like...