Rectify a allready georeferenced Image

PeterDrexelPeterDrexel Global Mapper UserPosts: 41Trusted User
edited June 2012 in Technical Support
Mike, I have a allready georeferenced Historical Map and I want to rerectify it. When I open it in the Image Rectifier it is loaded to 0/0 uper left corner an all the gcps are collected in pixel. As my map already has (sligtly inacurate) real world coordinates it should be loaded to that coodinates and the tehn collected gcps shoudl be real world and not pixels. When I use the Rerectify with vector-data it already uses real world coordinates, but I neat this for Rasterdata... Thanks Peter

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2012
    The rectify for images defines a mapping of pixel coordinates in the image to some ground coordinates, so you have to select the location where the new ground coordinates are on the image. You would be graphically selecting where the coordinates are on the image anyway in most cases so whether an existing ground coordinate is known for that point or not isn't important. If you just need to edit the location of existing control points you can double-click on them in the list and then get the input fields populated from them, then edit the values and update the GCP.

    If what you have is a list of existing ground coordinates and new ground coordinates to assign to that location, rather than rectify you can choose the Shift/Transform option in the Control Center for the layer and provide the list of input and output control points to transform the image location with.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • PeterDrexelPeterDrexel Global Mapper User Posts: 41Trusted User
    edited June 2012
    Mike,
    Perfect solution using Shift/Transform - shame on me I did miss that option...
    Thanks
    Peter
  • PeterDrexelPeterDrexel Global Mapper User Posts: 41Trusted User
    edited June 2012
    Mike,
    one more question:

    Is there any possibility to batch this?
    In total I have 800 maps I want to improve the positioning using "Shift Selected Layer(s) - Transform Coordinates Based on File (current_x,current_y,new_x,new_y)".
    What does work so far is for example loading all of them into Globalmapper and shift all of them but I cant find a way to export them all one by one.
    Is it possible to do this in the batch convert dialog or via the scripting language - I cant find anything - and if not is it possible to implement this feature into Globalmapper (for Example in the Batch Convert Dialog - I habe one Controlpoint-File which is valid for all Maps).
    Does this shifting-transformation use something like rubbersheading to do the transformation?
    Thanks
    Peter
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2012
    Peter,

    If you already have all of the files loaded and transformed in the main map view, you can do a batch conversion from those same files to new ones and the shift/transform that has already been applied in the main map view will also be applied during the batch conversion process.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • PeterDrexelPeterDrexel Global Mapper User Posts: 41Trusted User
    edited June 2012
    Mike,
    Thanks for the quick reply, your solution works - also it is not very suitable for me because loading all the files into GM and than manualy aply the Shift-File takes hours...
    One problem I still see is that the Checkbox "Never Anti-Alias" seams not to work. I am loosing the "sharpness" of the orinal Images when I Setup a fixed Sample Sapcing for all the exported Images because gm is Anti-Aliasing.
    Does this shifting-transformation use something like rubbersheading to do the transformation?
    It would be realy great if I could script the whole procedure...
    Thanks
    Peter
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2012
    Peter,

    Is the shift file the same for all files or has the same name or something like that? I could probably add a way via a script to easily provide a transform file for an existing file, then you could easily loop on them in a script and export them. Or if the file is the same for all I could potentially even add it as an option in the batch convertor.

    The shift-transformation is going to rubber-sheet the coordinate to warp them from one to another. I would typically think you would want to use anti-aliasing for this otherwise you will get up to one pixel shifts depending on where a sample location end up in the original image. With interpolation (anti-aliasing) enabled you will get a much better result as each sample location will take into account where in a source pixel it lands and interpolate based on that.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • PeterDrexelPeterDrexel Global Mapper User Posts: 41Trusted User
    edited June 2012
    Mike,
    in my case the shift is based on one controlpoint-file for all images (they are all misaligned the same way).
    But I think I would also be usefull to have one seperate for euch image, maybe named something like "imagename".gcp or so?
    The interpolation-isue is not a to big one, bit I am wondering why gm is not accepting using the do "Never Anti-Alias" 'checkbox?

    thanks
    Peter
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2012
    Peter,

    Actually if you load an un-referenced image that has an associated .gcp file Global Mapper will already find that and use it to setup the mapping from pixel space to a ground coordinate system. However since you have mappings from coordinate space to new coordinates that won't work, it would have to be something different for the transformation file. Are your shifts all consistent in terms of just an offset/scale (and maybe rotate) or are they more complex and only defined via control points? I ask because GM also supports finding and using a .gm_xform file that defines a transformation in terms of offset/scale/rotate and that could easily be extended to automatically be found for raster layers. If you have to use the coordinate space transformation method I may define another standard extension (what do your files have now) that Global Mapper will look for when loading to transform the files, or at least provide a way to specify it via a script.

    The 'Never Anti-Alias' option is surprising. How are you sure that anti-aliasing is being done?

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • PeterDrexelPeterDrexel Global Mapper User Posts: 41Trusted User
    edited June 2012
    Mike,
    the controlpoint-file contains more then 1000 points (x_old, y_old, x_new, y_new) over an area of 3000 km². Most of the the misaligned images cover only parts of the area, but they are all misaligned to the same wrong koordinates (an old countrywide map with huge, not modelable shifts and faults and ups and downs...). So there is no way to do the work by just apllying offsets or rotations or scales... My file now hast the ending .trans (for transformation).

    The "Never Anti-Alias" isue:
    I Load one of the Images directliy into GM13, then I use Shift/Transform with my .trans file - the image is now moved to the correct position and then i export it to a 25x25cm-Geo-Tif - the Image is sharp. When I load this Image into GM I see exactly the same Image as the "real-Time-shifted one"
    If I load 100 Images into GM13, then Shift/Transform all of them with my .transfile - then use the batch export - all loaded images - even check the never anty-alias and select the spacing 25x25cm the Tifs get smoothed. When I then load one of the new Images into GM (on top of the ones with the already applied Shift/Transform I see a smoothed, not clear version of the image.
    Thanks
    Peter
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2012
    Peter,

    It sounds like a way to select the transform file for all would work best. Would doing this via a script work or does it need to be in the batch convertor?

    For the anti-alias it sounds more like the file is loaded in with resampling enabled. If you go to the Options dialog for the newly loaded layer is it coming in with the resampling method set to something other than Nearest Neighbor (No Resampling)?

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • PeterDrexelPeterDrexel Global Mapper User Posts: 41Trusted User
    edited June 2012
    Mike,
    implementing it via script is perfect for me.

    Anti-Alias: I finaly found the "Disable Automatic Interpolation of Resampled Exports" Checkbox in the General configuration Tab. If this is not checked it seams to overrule the "Never Anti-Alieas Pixels (Interpolate)" in the Batch-Converter. So if I check the "Disable Automatic Interpolation of Resampled Exports" Checkbox in the General configuration Tab it works, just checking "Never Anti-Alieas Pixels (Interpolate)" in the Batch-Converter does not work.
    Thanks
    Peter
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2012
    Peter,

    I have added support for adding TRANSFORM_FILENAME to an IMPORT command in a script to provide the name of a control point file for doing a coordinate-to-coordinate transformation. I also fixed the issue with the 'Never Anti-Alias' option being overridden by the auto-resample in a script. I have placed a new build at http://www.globalmapper.com/global_mapper13.zip with the latest changes for you to try. Simply download that file and extract the contents into your existing v13.xx installation folder to give it a try. If you are using the 64-bit v13 version there is a new build at http://www.globalmapper.com/global_mapper13_64bit.zip .

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • PeterDrexelPeterDrexel Global Mapper User Posts: 41Trusted User
    edited June 2012
    Mike,
    I downloaded the 64bit-Version, thanks.

    I tried to run a Script but I was not sucessfull...

    My Script "D:\test.gmw" looks like:

    GLOBAL_MAPPER_SCRIPT VERSION="1.00" FILENAME="D:\test.gmw"
    UNLOAD_ALL
    DEFINE_PROJ PROJ_NAME="AUSTRIA_ZONE4_MGI_AUSTRIA"
    Projection Austrian Grid
    Datum MILITAR_GEOGRAPHISCHE_INSTITUTE
    Zunits NO
    Units METERS
    Zone 4
    Xshift 0.000000
    Yshift 0.000000
    Parameters
    END_DEFINE_PROJ
    IMPORT FILENAME="S:\to_110621_064458_00002.tif" \
    TYPE="GEOTIFF" PROJ_NAME="AUSTRIA_ZONE4_MGI_AUSTRIA" RECTIFY="Automatic" \
    SAMPLING_METHOD="NEAREST_NEIGHBOR" AUTO_CONTRAST="YES" CONTRAST_SHARED="YES" CONTRAST_MODE="MIN_MAX" CLIP_COLLAR="NONE" \
    TRANSFORM_FILENAME= "D:\GMsfX.txt"


    The Transform_File "D:\GMsfX.txt" looks this way: (x_old,y_old,x_new,y_new)

    -37883.77000,230221.53000,-37884.80000,231632.34000
    -38275.85000,233619.37000,-38278.51000,235038.59000
    -35740.54000,231425.34000,-35741.93000,232800.04000
    -37050.47000,231057.10000,-37044.59000,232453.96000
    ...

    When I run the Script inside GM13 I get the following errors:
    WARNING: Unable to open GCP list file.
    WARNING: The rectification method requirer at least 2 GCPs.
    Only 0 GCPs were provided. No rectification will be performed.

    I also tried (Name,x_old.y_old,x_new,y_new)
    "1",-37883.77000,230221.53000,-37884.80000,231632.34000
    "2",-38275.85000,233619.37000,-38278.51000,235038.59000
    "3",-35740.54000,231425.34000,-35741.93000,232800.04000
    "4",-37050.47000,231057.10000,-37044.59000,232453.96000
    ...

    -> same result.

    What am I doing wrong? Can you please provide a sample-gms with a sample-gcp-file?
    Thanks
    Peter
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2012
    Peter,

    You just about had it correct the first time, just leave off the RECTIFY parameter. When that parameter exists the script will expect to fine traditional GCPs (i.e. pixel to ground coordinate space) which you don't have. Just the TRANSFORM_FILENAME parameter should be all that you need with the first way that you had it (xOld,yOld,xNew,yNew).

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • PeterDrexelPeterDrexel Global Mapper User Posts: 41Trusted User
    edited June 2012
    Mike,
    everything works fine now, also the anti aliasing.
    In my script was an aditional error: In the line
    TRANSFORM_FILENAME= "D:\GMsfX.txt" was a space between the "=" and the filename.
    Thanks a lot.
    Peter
  • HH123HH123 Posts: 1
    Dear All,

    I rectify the aerial imagery by global mapper. My question is about the mathematical model (affine, projective, ...) which is used in Global Mapper?

    Could you tell me what the registration model is? and How can we export the model parameters?


    Best Regards,



Sign In or Register to comment.