Friday, 20 October 2017

raster - How to generate a world file with rotation


I`m writing code to geo reference some images that I get with a rc plane. I have the central coordinate of the image because its atached to the center of the plane. But I have problems when I open the images + jpw in quantum gis, their center doesn't match a point shape that I made with the coordinates that I assume as the center of the plane.


My doubt is, the 2 last lines of the world file represent the coordinate of the center of the upper left pixel of the image, but if the plane is heading south when the image has taken this is will be the lower right pixel coordinate? What I'm doing right now is moving the four coners of my image to 0,0, rotating it by my heading, and moving it back, am I doing something wrong?


The formulas that i`m using to calculate the first four lines of the world file are those:


A = Cos((PI / 180) * Heading) * XPixSize;
D = Sin((PI / 180) * Heading) * -YPixSize;

B = Sin((PI / 180) * Heading) * -XPixSize;
E = Cos((PI / 180) * p.Heading) * -YPixSize;

enter image description here


EDIT: I'm changing the aproach, now I'm rotating the image with a program to orientate it to north, but I'm still having problems to georefece it, I have the centroid coordinate in Lat, Lon, both sizes of the original image in meters, and the size in pixel of the new, and the old images, but i'm still having problems to create the worldfile.


Just one detail: when I rotate the image, the program creates a image bigger than the original, to let the rotated image fit in.


My question is now similar to this one: georeferencing aerial photos with only known centroid




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...