Hi all,
I need to subset a lot of images using another image (Let's just call it the reference image). I would like these images to have the same projection, extent, and exactly-matched pixels. The images to be subset have the same spatial resolution with the reference image. Here's my way of doing it. Please let me know if you think it's legitimate.
1. Get the file coordinates of the reference image, convert it to map coordinates, and then to lat/lon.
2. For each image to be subset, convert the 2D-array of lat/lon we got from the reference image to map coordinates, and then to the file coordinates, with respect to the image to be subset.
3. Use the 2D- array of file coordinates to subscribe the original image to be subset, and get a new image. I suppose the pixel locations of the new image matches exactly those of the reference image. Use the same map_info of the reference image to set up the header for the new image.
Thus we can get the image that matches exactly with the reference image, in terms of either projection, extent and pixel locations. I was just wondering if this is a legitimate way to do it, because usually we would warp the image to the new projection and then do the subset,although this would lead to discrepancy between pixels on the two images that are supposed to align with each other.
Thanks a lot!
|