There are probably many different ways to compare 2 pixel values of 2 different images using their map coordinates. Here is an example using some ENVI programming routines.
If you could build a similar code to read your 2 different tiff images thus you would be able to compare the pixel values that correspond to a same map location.
**********************************************************************************************************
PRO example
; This example is built using an image of the ENVI distribution, that had been first exported
; to a GEOTIFF image using ENVI: C:\RSI\IDL63\products\envi43\data\bhdemsub.img
fname =dialog_pickfile()
; open the TIFF/GEOTIFF file
envi_open_data_file, fname, /tif, r_fid=fid
if (fid eq -1) then RETURN
; Query and print the dims, ns, nl, and nb
ENVI_FILE_QUERY, fid, dims=dims ,ns=ns, nl=nl, nb=nb
print, "dimensions = ", ns, nl, nb
; Retrieve the data (values of each pixel) in the array called “data”
data = ENVI_GET_DATA(fid=fid, dims=dims, pos=0)
; Retrieve the map information: it returns a structure with all the different map information
map_info = envi_get_map_info(fid=fid)
print,'map_info structure'
help,map_info,/struct
; The size of the pixel (resolution) is saved in the map_info.ps array of the structure
X_px_size=map_info.ps[0]
Y_px_size= map_info.ps[1]
; The latitude and longitude of the reference point is saved in the map_info.mc array:
; The 2 first components of this array are the pixel locations of the point
; (0,0) in this example
; The 2 other components correspond to the longitude and latitude of this point
min_lon=(map_info.mc)[2]
max_lat=(map_info.mc)[3]
; using the previous information it is possible to calculate the maximum longitude
; and the minimum latitude
max_lon= min_lon + X_px_size*(ns-1)
min_lat= max_lat - Y_px_size*(nl-1)
; Now it is possible to retrieve the pixel value of a point identified by its latitude
; and its longitude
; example with the 2 following points
lat_list=[4905171.20d,4895481.20d]
lon_list=[277408.57d, 287968.57d]
; First it is necessary to calculate the corresponding pixel position
X_px_pos= (lon_list-min_lon) / X_px_size
Y_px_pos = (max_lat-lat_list) / Y_px_size
; thus it is possible to retrieve the pixel values using the pixel positions
value=data[X_px_pos,Y_px_pos ]
PRINT,'pixel value = ',value
END
|