From: Katie G on 22 Jul 2010 19:22 Does the geotiff writer work for photographs? I'm trying to create geotiffs for a job at work, but I'm terrible at matlab.... On Jun 21, 10:55 am, "Jimmy Shen" <newsrea...(a)mathworks.com> wrote: > Dave Esrig <esrig_d...(a)jpmorgan.com> wrote in message <3AB22953.B1972...(a)jpmorgan.com>... > > I suspect this question has been covered in this group but I could not > > find it in a Google search: Does anyone know if Matlab can be made to > > create geotiffs? I'm still running 5.3. > > Thanks, > > Dave Esrig > > Try geotiffwrite() under:http://www.mathworks.com/matlabcentral/fileexchange/27959 > (It supportS MATLAB 5.3.1)
From: Jimmy Shen on 22 Jul 2010 21:56 Hi Katie: Sure you can! The example of "o41078a5.tif" in: http://rotman-baycrest.on.ca/~jimmy/geotiffwrite/#Examples tells you how to do that. Here's some brief explanation, hopefully it can help you somehow: "option.GTModelTypeGeoKey = 1;" tells you that Projection Coordinate System is used. "option.ModelPixelScaleTag = [2.4384;2.4384;0];" and "option.ModelTiepointTag = [0;0;0;698753.304798;4556059.506392;0];" tells you the scale and landmark. You can construct an affine transformation matrix from the above parameters: M=[2.4384 0 0 698753.304798;0 -2.4384 0 4556059.506392;0 0 0 0; 0 0 0 1]; Since the size of image is 6763x4992, we can easily pick 2 landmarks to verify: Point (0, 0), and point (4992, 6763): Point1: N1=M*[0;0;0;1]; % it is (698753.3, 4556059.5) Point2: N2=M*[4992;6763;0;1]; % it is (710925.8, 4539568.6) Please note that the above N1 & N2 are both in UTM. You can double verify the results from: info.CornerCoords.PCSX & info.CornerCoords.PCSY when you use geotiffinfo to obtain "info". As you can see, as long as you have enough information for your scanned map, you can easily build option.ModelPixelScaleTag, option.ModelTiepointTag, or simply bbox if you just want to use Geographic latitude-longitude System. Then, you can easily create your GeoTIFF file by the image data along with the GeoTIFF parameters that you calculated. Jimmy Katie G <kgalloway21(a)gmail.com> wrote in message <942277aa-0b8d-415b-b384-f54ba30621a3(a)m35g2000prn.googlegroups.com>... > Does the geotiff writer work for photographs? I'm trying to create > geotiffs for a job at work, but I'm terrible at matlab.... >
From: Jimmy Shen on 26 Jul 2010 13:32 In order to use 'bbox', you need to find the latitude / longitude at 4 corners of the image matrix that you 'imread' in from your photograph file. In most cases, there are margins at 4 edges. But it is still very easy to calculate the 4 corners based on lat / long inside the photographed image. Once you have the bbox, you can easily write GeoTIFF like this: geotiffwrite('MyGeoTIFF.tif', bbox, img) Make sure the orientation of 'img' is 'Row from Top, Col from Left', i.e. 'First row at North edge, last row at South edge, First column at West edge, last column at East edge'. When you use 'image' or 'imagesc' to display the 'img', it has the same orientation as 'MyGeoTIFF.tif' does.
|
Pages: 1 Prev: slow matlab from within vb.net Next: Creating a binary mask using imfreehand |