Contrast Adjustment on Export Issue

adrufadruf Global Mapper UserPosts: 17Trusted User
edited May 2010 in Raster Data
Hi GM Forum, I have been attempting to mosaic TIF tiles (appx 1200) into ECW format. When I load 5 or 6 of these tiles into the Global Mapper workspace, they are each discolored and seem to have a white-out effect. I was able to fix this problem for the loaded tiles this way:

'Overlay Control Center' > 'Options...' > 'Modify Display of Raster Layers...' > 'Color/Contrast Adjustment' Tab > and within the 'Contrast Adjustment' field, I selected the 'Linear (Minimum/Maximum Stretch)' radio button and un-checked 'Share Contrast Adjustment with Other Layers'

This process corrects the visual display of my tiles in GM, however when I proceed to batch export them, it seems no matter what I try, I cannot get the tiles to export with these same settings. Is there a default setting that I can change in GM to correct the contrast adjustment error in the batch export? Thank you for your help.

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2010
    Currently what you would need to do is first load all of the files to convert into the main user interface and setup the contrast mode, then do your batch conversion using loaded files and check the option to automatically adjust contrast. Then your settings from the loaded file would be used.

    If you can't do this due to the number of files, you would instead need to use a Global Mapper script file to do the conversion and setup the appropriate contrast during the IMPORT command. Use the DIR_LOOP_START and DIR_LOOP_END commands to loop over files to convert them.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2010
    Currently what you would need to do is first load all of the files to convert into the main user interface and setup the contrast mode, then do your batch conversion using loaded files and check the option to automatically adjust contrast. Then your settings from the loaded file would be used.

    If you can't do this due to the number of files, you would instead need to use a Global Mapper script file to do the conversion and setup the appropriate contrast during the IMPORT command. Use the DIR_LOOP_START and DIR_LOOP_END commands to loop over files to convert them.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • adrufadruf Global Mapper User Posts: 17Trusted User
    edited May 2010
    Thanks for your assistance, Mike.

    I wrote a script that gets the job done just as I'd like when I test run it on a few tiles. However, I get an error when I attempt to import all 1220 tiles just after importing 800 of the tiles (66%). I can resolve the issue, I presume, by breaking the import of the tiles in half and then exporting to two ecw's that I would then merge together, but if there's a way I can make the process happen all in one step, I'm all for it! Maybe you can help, here's my script:

    Script:
    GLOBAL_MAPPER_SCRIPT VERSION=1.00
    UNLOAD_ALL

    DIR_LOOP_START DIRECTORY="G:\DIR\Wico\" FILENAME_MASKS="*.TIF" RECURSE_DIR=NO

    IMPORT FILENAME="%FNAME_W_DIR%" CONTRAST_MODE=MIN_MAX CONTRAST_SHARED=YES PROJ_FILENAME="Y:\Data\Orthos\2007_08_FROMDNR_20090713\WICO\ProjectionFile\NAD83.prj"

    DIR_LOOP_END

    EXPORT_RASTER FILENAME="Y:\Data\Orthos\2007_08_FROMDNR_20090713\WICO\ECW\Wicomico_07_08_nad83.ECW" TYPE=ECW GEN_WORLD_FILE=YES

    UNLOAD_ALL




    The error Message I received looked like this:

    Error:
    Removed all loaded overlays.
    Starting loop over all files in directory...
    ...
    Importing file G:\07CIR\WICO\SPATIAL\XX.TIF
    ERROR: Error processing script.
    C:\Development\global_mapper10\TIFFOverlay.cpp - 2059

    Thanks for any help you might have!
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2010
    For such a large number of files I would definitely suggest creating a map catalog (File->Create New Map Catalog) from all of the TIFF files, then load that map catalog in your script and exporting from that. The map catalog will much more efficiently deal with a large collection of files.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • adrufadruf Global Mapper User Posts: 17Trusted User
    edited May 2010
    I tested loading a catalog on a few tiles and my exported ECW had the same results as before - discolored images. Is there something I'm missing in my script. Before attempting a script, when I loaded the tiles in as seperate layers, I was able to check 'Share Contrast Adjustment with Other Layers.' Having this option checked made all the difference in having the all the tiles adjusted correctly. I have opted for it in my script, but the reason it won't work is because the map catalog is only one layer. Using GM, this option was greyed out only when I had opened a map catalog. I can still think of ways to navigate this problem, but I'd prefer not having to do them because they will take hours longer to process.

    Script:
    GLOBAL_MAPPER_SCRIPT VERSION=1.00
    UNLOAD_ALL

    IMPORT FILENAME="Y:\Data\Orthos\2007_08_FROMDNR_20090713\WICO\TEMP_WICO_TILECATALOG.GMC" TYPE=GLOBAL_MAPPER_CATALOG CONTRAST_MODE=MIN_MAX CONTRAST_SHARED=YES PROJ_FILENAME="Y:\Data\Orthos\2007_08_FROMDNR_20090713\WICO\ECW\ProjectionFile\NAD83.prj"

    EXPORT_RASTER FILENAME="Y:\Data\Orthos\2007_08_FROMDNR_20090713\WICO\ECW\Wicomico_07_08_nad83.ECW" TYPE=ECW GEN_WORLD_FILE=YES

    UNLOAD_ALL


    Thanks for anything you can add!
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2010
    Ah sorry, when I responded earlier I didn't realize that was this thread and you needed to share the contrast, which means all of the layers need to be loaded at once. Which v10 release are you using? I wasn't able to match up your error line to a line in the latest v10 source.

    You might try going back to your original script, then updating to the latest v10 build to see if that helps (or can at least give me a better error). I have placed a new build at http://www.globalmapper.com/global_mapper10.zip with the change for you to try. Simply download that file and extract the contents into your existing v10.xx installation folder to give it a try.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • adrufadruf Global Mapper User Posts: 17Trusted User
    edited May 2010
    Thanks Mike, I'm testing out the original script now on the new build. And as you requested, I am using v10.02
  • adrufadruf Global Mapper User Posts: 17Trusted User
    edited May 2010
    Mike, I've run the script on the new build you sent me and here is the error I have returned. I could modify the script to open each tile individually and export them as ecw's unloading after each loop. Then I could simply catalog and export as a single ecw, I am fairly certain this process would work, I'm just looking for a faster method if you can help:

    Error:
    Removed all loaded overlays.
    Starting loop over all files in directory...
    ...
    ...
    Importing file G:\07CIR\WICO\SPATIAL\JS347.tif...
    WARNING: Unable to load projection from file Y:\Data\Orthos\2007_08_FROMDNR_20090713\WICO\ECW\ProjectionFile\NAD83.prj
    WARNING: Unable to load overlay JS347.tif
    Out of memory.
    OverlayFactory.cpp - 2202
    Build Time: Mar 21 2010 13:27:47
    WARNING: No overlays could be loaded from file <G:\07CIR\WICO\SPATIAL\JS347.tif>.
    Loop over files in directory completed.
    Exporting raster data to file Y:\Data\Orthos\2007_08_FROMDNR_20090713\WICO\ECW\Wicomico_07_08_nad83.ECW...
    WARNING: Unable to generate ECW file Y:\Data\Orthos\2007_08_FROMDNR_20090713\WICO\ECW\Wicomico_07_08_nad83.ECW.
    An error has occurred: Error 46 "Could not allocate enough memory" file "" line 0
    ECWOverlay.cpp - 1576
    Build Time: Mar 21 2010 13:27:47
    Removed all loaded overlays.
    Script processing COMPLETED.

    Thanks, kindly!
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2010
    It sounds like you are running out of memory with all of those TIFF files loaded. The 64-bit v11 would help, but using v10 your best bet is to create corrected TIFF (not ECW as that would be lossy) files by looping over them and exporting new ones, then building a catalog from those and exporting directly to a ECW file from that (no contrast correction needed at that point).

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
Sign In or Register to comment.