Say I have a satellite image of known dimensions. I also know the size of each pixel. The coordinates of some pixels are given to me, but not all. How can I calculate the coordinates for each pixel, using the known coordinates?
In this case, and if you do not want (or don't need) to georeference the raster, I'd suggest that you hold the known coordinates in a metric system (like UTM). With the known coordinates, you may get to know the coordinates of any pixel with simple math (like the draft I posted). Remember that it is only valid if your known coordinates are pixel centroids.
If tou habe only the coordinates or some pixels and if the imafe is not too large, the simplest wat is to fit a linear model linking coordinates with pixel row and line numbers by mimimal square erir techniques. (or best, insted of coordinates use loitude and latitude multiplied by cos latitude. This results in a linear correspondance quite easy to deal with.
You must perform georeferencing using the pixels of known coordinates. This process requires resampling to create a new image within the given satellite image with the same or different pixel size if the coordinates of known pixels are (I,j) in the image file and (x,y) in the ground system. The formulas i=fi(x,y) and j=fj(x,y) allow for the calculation of the transformation coefficients (usually linear or bilinear), and then the new image is aligned along the x,y-axis. The grayscale values in the new image are resampled from the corresponding (i,j) location of the original image calculated using the transformation functions fi and fj. If you want to calculate the x,y coordinates of any pixel with unknown ground coordinates, you do the opposite formulation as: x=fx(i,j), y=fy(i,j). Analytically, the bilinear transformation has four coefficients as follows:
x=a0+a1.(i)+a2.(j)+a3.(i.j), y=b0+b1.(i)+b2.(j)+b3.(i.j) Using at least four pixels with known i,j and x,y coordinates you calculate the unknown coefficients ai, bi. Using more such points, you perform a least squares adjustment with error analysis.
I agree with some of the previous answers. I think the best approach is to perform the georeferencing of your raster image, then you´ll have the coordinates for all the pixels. There are several software packages you can use for this purpose, like QGIS which is free. If you are unfamiliar with this type of software let me know, and I can upload a small tutorial. regards
We can find the coordinates of each pixel of satellite image by geo-referencing of some known points on the ground which are shown in Topo map. The RMS error should be less than 0.5 m.
Thank you all for the answers! John Hatzopoulos , to give a little more detail. In an image of 20x20km, it is given me a coordinate at every 1km. My goal is to create a code that can then give me the rest of the coordinates for the pixels that I have no information. My question is, I have to perform first the resampling of the image then? And then apply some sort o f interpolation as you mention?
Thank you for your help, I'm still knew to this since I normally perform georeferencing using QGIS.
Therefore, you have 20x20 = 400 control points. If you do georeferencing in Qgis, you can use all control points or some of them, like every 5 Km (16-points). During resampling, all pixels have coordinates in the ground system.
If you do not do georeferencing (no resampling), then you could calculate the coordinates of unknown pixels by interpolation. Suppose a pixel size a [m], then in one km, you have p = 1000/a pixels, and therefore known coordinates have the first(x1,y1) and the last(x2,y2) pixel. The slope angle between the first and last pixel is:
s = arc-tan[(x2-x1)/(y2-y1)]. Therefore, a pixel of a distance d from the first pixel has coordinates x = x1 + d.sin(s) and y = y1 +d.cos(s). You can do either row of column interpolation or both and take the average.