[gdal-dev] Georeference without rotation of output image

Even Rouault even.rouault at spatialys.com
Fri Aug 14 09:19:37 PDT 2015


Le vendredi 14 août 2015 17:17:34, Ivan Castellucci Vidal a écrit :
> Hi, list
> 
> First of all, I searched on the list but I hadn't found anyone with the
> same issue as me.
> 
> I'm working with aerial images of fields that I use as input to my program
> which needs to process the images and find some visual patterns and then
> give some output for the users.
> 
> I use georeferenced images because I need to extract geographic data after
> my program process the image. So, when I warp my image with gdalwarp it
> rotates the image and as a consequence of northing up the image, it rotates
> the raster and adds 4 black triangles to make it rectangular.
> 
> The problem is, when I run my program, this "borders" are messing with my
> algorithm and are a source of inaccuracy on the image processing. I can get
> rid of them with more image processing but any extra step is
> computationally heavy, specially when using large images.

During the warping, you could add an alpha channel or set a destination nodata 
value so as to be able to identify the generated transparent areas

> 
> I would need to avoid the rotation of the raster after gdalwarp is used to
> implant the geotransformation on the destination image. I don't really care
> if the image is not north up after warping it so I may not need gdalwarp
> and instead I may be able to use some other solution based on the C API if
> needed.
> 
> If it's relevant, the source images are in JPEG format and the destination
> are in GeoTiff format, the transformation is done by using 3 (sometimes
> more) GCPs and I'm using EPSG:4326 projection.

Instead of warping the image, you could compute a geotransformation matrix 
that would include rotational terms with GDALGCPsToGeoTransform()

http://www.gdal.org/gdal_8h.html#ae44b32f08d61072dddbdd30ac8ca962b

and set it to your geotiff with GDALSetGCPs()

http://www.gdal.org/gdal_8h.html#acd47aa85ca5751fbe9ea09c1a2341ef8

> 
> I didn't explained details of the pattern recognition process because I
> think it's irrelevant to my problem and it will be confusing but if you
> need any, just let me know.
> 
> 
> Any help is appreciated,
> 
> Thanks in advance

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list