GFZ / arosics

AROSICS - Automated and Robust Open-Source Image Co-Registration Software
https://git.gfz-potsdam.de/danschef/arosics
Apache License 2.0
137 stars 26 forks source link

pyproj.exceptions.CRSError: Invalid projection: : (Internal Proj Error: proj_create: unrecognized format / unknown name) #9

Closed 113HQ closed 1 year ago

113HQ commented 2 years ago

arosics version: 1.7.6 Python version: Python 3.7 Operating System: Windows 10

Description: An error occurs when running the sample program

What I Did “from arosics import COREG_LOCAL im_reference = r'E:\PYTHON_code\geometric_correction\images\test5_GF1\ref.tif' im_target = r'E:\PYTHON_code\geometric_correction\images\test5_GF1\GF1.tiff' kwargs = { 'grid_res' : 200, 'window_size' : (64,64), 'path_out' : 'auto', 'projectDir' : 'my_project', 'q' : False, } CRL = COREG_LOCAL(im_reference,im_target,**kwargs) CRL.correct_shifts()”

Traceback

Calculating footprint polygon and actual data corner coordinates for reference image... Bounding box of calculated footprint for reference image: (112.10955028669473, 21.36469388207095, 114.60440351997283, 23.78935600552229) Calculating footprint polygon and actual data corner coordinates for image to be shifted... Warning 1: -te_srs ignored since -te is not specified. Polygonize progress |==================================================| 100.0% Complete => 0:00:01 Bounding box of calculated footprint for image to be shifted: (0.0, -13400.0, 11999.10668549955, -1.585086748414736) sys:1: UserWarning: First attempt to check the functionality of co-registration failed. Check your input data and parameters. The following error occurred:
Traceback (most recent call last): File "e:\PYTHON_code\geometric_correction\geo_correction.py", line 15, in CRL = COREG_LOCAL(im_reference,im_target,kwargs) File "D:\python3.7\lib\site-packages\arosics\CoReg_local.py", line 350, in init ignore_errors=False) File "D:\python3.7\lib\site-packages\arosics\CoReg.py", line 413, in init self._get_image_params() File "D:\python3.7\lib\site-packages\arosics\CoReg.py", line 550, in _get_image_params if not prj_equal(self.ref.prj, self.shift.prj): File "D:\python3.7\lib\site-packages\py_tools_ds\geo\projection.py", line 92, in prj_equal crs2 = CRS.from_user_input(prj2) File "D:\python3.7\lib\site-packages\pyproj\crs\crs.py", line 479, in from_user_input return cls(value, kwargs) File "D:\python3.7\lib\site-packages\pyproj\crs\crs.py", line 326, in init self._local.crs = _CRS(self.srs) File "pyproj_crs.pyx", line 2352, in pyproj._crs._CRS.init pyproj.exceptions.CRSError: Invalid projection: : (Internal Proj Error: proj_create: unrecognized format / unknown name)

danschef commented 2 years ago

Could you please run this on the command line and post the output here?

gdalinfo 'E:\PYTHON_code\geometric_correction\images\test5_GF1\ref.tif'
gdalinfo 'E:\PYTHON_code\geometric_correction\images\test5_GF1\GF1.tiff'

Please note that the co-registration accuracy decreases when setting the window_size parameter to values smaller than 256.

113HQ commented 2 years ago

Could you please run this on the command line and post the output here?

gdalinfo 'E:\PYTHON_code\geometric_correction\images\test5_GF1\ref.tif'
gdalinfo 'E:\PYTHON_code\geometric_correction\images\test5_GF1\GF1.tiff'

Please note that the co-registration accuracy decreases when setting the window_size parameter to values smaller than 256.

This is the result of ref.tif

gdalinfo E:\PYTHON_code\geometric_correction\images\test5_GF1\ref.tif Driver: GTiff/GeoTIFF Files: E:\PYTHON_code\geometric_correction\images\test5_GF1\ref.tif E:\PYTHON_code\geometric_correction\images\test5_GF1\ref.aux E:\PYTHON_code\geometric_correction\images\test5_GF1\ref.rrd Size is 25142, 26961 Warning 1: PROJ: proj_create_from_database: Cannot find proj.db Coordinate System is: GEOGCRS["WGS 84", DATUM["World Geodetic System 1984", ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1, ID["EPSG",9001]]]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433, ID["EPSG",9122]]], CS[ellipsoidal,2], AXIS["latitude",north, ORDER[1], ANGLEUNIT["degree",0.0174532925199433, ID["EPSG",9122]]], AXIS["longitude",east, ORDER[2], ANGLEUNIT["degree",0.0174532925199433, ID["EPSG",9122]]]] Data axis to CRS axis mapping: 2,1 Origin = (112.109550286694727,23.789356005522290) Pixel Size = (0.000099230500091,-0.000089932202939) Metadata: AREA_OR_POINT=Area TIFFTAG_RESOLUTIONUNIT=1 (unitless) TIFFTAG_SOFTWARE=IMAGINE TIFF Support Copyright 1991 - 1999 by ERDAS, Inc. All Rights Reserved @(#)$RCSfile: etif.c $ $Revision: 1.10.1.9.1.9.2.11 $ $Date: 2004/09/15 18:42:01EDT $ TIFFTAG_XRESOLUTION=1 TIFFTAG_YRESOLUTION=1 Image Structure Metadata: INTERLEAVE=PIXEL Corner Coordinates: Upper Left ( 112.1095503, 23.7893560) (112d 6'34.38"E, 23d47'21.68"N) Lower Left ( 112.1095503, 21.3646939) (112d 6'34.38"E, 21d21'52.90"N) Upper Right ( 114.6044035, 23.7893560) (114d36'15.85"E, 23d47'21.68"N) Lower Right ( 114.6044035, 21.3646939) (114d36'15.85"E, 21d21'52.90"N) Center ( 113.3569769, 22.5770249) (113d21'25.12"E, 22d34'37.29"N) Band 1 Block=512x512 Type=Byte, ColorInterp=Gray Description = Layer_1 Overviews: 12571x13481, 6286x6741, 3143x3371, 1572x1686, 786x843, 393x422, 197x211, 99x106, 50x53, 25x27 Metadata: LAYER_TYPE=athematic

Band 2 Block=512x512 Type=Byte, ColorInterp=Undefined Description = Layer_2 Overviews: 12571x13481, 6286x6741, 3143x3371, 1572x1686, 786x843, 393x422, 197x211, 99x106, 50x53, 25x27 Metadata: LAYER_TYPE=athematic

Band 3 Block=512x512 Type=Byte, ColorInterp=Undefined Description = Layer_3 Overviews: 12571x13481, 6286x6741, 3143x3371, 1572x1686, 786x843, 393x422, 197x211, 99x106, 50x53, 25x27 Metadata: LAYER_TYPE=athematic

This is the result of Gf1.tifF

gdalinfo E:\PYTHON_code\geometric_correction\images\test5_GF1\GF1.tiff Driver: GTiff/GeoTIFF Files: E:\PYTHON_code\geometric_correction\images\test5_GF1\GF1.tiff Size is 12000, 13400 Image Structure Metadata: INTERLEAVE=PIXEL Corner Coordinates: Upper Left ( 0.0, 0.0) Lower Left ( 0.0,13400.0) Upper Right (12000.0, 0.0) Lower Right (12000.0,13400.0) Center ( 6000.0, 6700.0) Band 1 Block=12000x1 Type=UInt16, ColorInterp=Gray NoData Value=0 Band 2 Block=12000x1 Type=UInt16, ColorInterp=Undefined NoData Value=0 Band 3 Block=12000x1 Type=UInt16, ColorInterp=Undefined NoData Value=0 Band 4 Block=12000x1 Type=UInt16, ColorInterp=Undefined NoData Value=0

Thank you for all your assistance !

danschef commented 2 years ago

This looks like your target dataset Gf1.tiff does not have a valid projection. Make sure the projection is correctly stored in the image metadata and try again.

Warning 1: PROJ: proj_create_from_database: Cannot find proj.db

There also seems to be an issue with the installation of gdal on your machine. This may also cause problems when reprojecting image data. I suggest to follow the installation instructions of arosics: https://danschef.git-pages.gfz-potsdam.de/arosics/doc/installation.html

danschef commented 1 year ago

I close this due to inactivity. Feel free to re-open if needed.