0

I'm working on a project involving data from the Lunar reconnaissance orbiter. Datasets are usually 5064 pixels wide and 52224 pixels in height, and the general (2 significant figures) coordinates for latitude and longitude are given in the metadata for the center of the observation as well as each of the corners. A typical observation with those coordinates might look something like this:

The observation M1131630333R from the LROC archive.

Let's say I wanted to get the pixel values of the center of the prominent crater in this image that I know the Latitude and Longitude of. In this case, the coordinates of that crater are -11.80 South and 33.14 East. How could I do that?

A few notes, some of these images are inverted, as the orbiter might have south as up. The observations are also usually not straight, as the orbiter does not have a perfect polar orbit, though occasionally the side latitudes or top/bottom longitudes match up.

Here is some python code I have tried to use so far (assuming that x values increase as you go eastwards and y values increase as you go southwards):

(using Numpy as np)

eps_x_left = Lower_left_longitude - Upper_left_longitude
eps_x_right = Lower_right_longitude - Upper_right_longitude

eps_y_up = Upper_right_latitude - Upper_left_latitude
eps_y_low = Lower_right_latitude - Lower_left_latitude

# handle case where x's or y's are equal: means slope is infinite
if eps_x_left != 0:
    mx = (Upper_left_latitude - Lower_left_latitude)/eps_x_left 
else:
    mx = np.infty

if eps_y_up != 0:
    my = (Upper_right_longitude - Upper_left_longitude)/eps_y_up
else:
    my = np.infty

x_prime = (y_tar - Upper_left_latitude)/mx + Upper_left_longitude
y_prime = (x_tar - Upper_left_longitude)/my + Upper_left_latitude

r_x = abs(Upper_right_longitude + eps_x_right 
          - Upper_left_longitude + eps_x_left)/img_size[0]
r_y = abs(Upper_left_latitude + eps_y_up 
          - Lower_left_latitude + eps_y_low)/img_size[1]

p_x = int(abs(x_tar - x_prime)/r_x)
p_y = int(abs(y_tar - y_prime)/r_y)

This code seems to work fine, but if I have two observations of the same crater that are at different rotations, the location I get is not always the same.

byteGeist
  • 73
  • 1
  • 6
  • It's hard to follow your code. You're doing a lot of arithmetic, with variables that have unhelpful names: `eps, m, prime, r, p`. I have no idea what any of these are and how they're related to your problem. – Stef Dec 11 '21 at 22:18
  • If the crater is the very bright thing in the middle, my first idea would be to use thresholding or watershed to decides which pixels are part of the crater. Then you can find the disc that best fits your crater, and the center of that disc is the center of your crater – Stef Dec 11 '21 at 22:24

0 Answers0