Combine Ikonos rgb bands and IR band into a single 4 band image

rfoleyrfoley Global Mapper UserPosts: 4
edited February 2010 in Technical Support
Is there a way to combine 4 ikonos images (1 - red band, 2 - green band, 3 - blue band, 4 - IR band) into a single 4 band image?

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited February 2010
    Yes, in v11 just load the 4 separate images, then use the File->Export Raster->Export GeoTIFF menu command and choose the multi-band export option. You'll be able to choose which band in the export file comes from which bands from which loaded files to create the combined RGBI image.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • OGLOGL Posts: 2
    Hello, I know this is an old thread, but is there a way to do this in a batch? We have a couple thousand images to merge into 4-band.

    Thanks in advance.
  • OGLOGL Posts: 2
    I managed to make a script to do this. For some reason I had to work backwards with the IF statement (the combine_str didn't recognize the "=" operator) but it works:

    GLOBAL_MAPPER_SCRIPT VERSION="1.00"
    UNLOAD_ALL
    LOG_MESSAGE Script <%SCRIPT_FILENAME%> started at %DATE% %TIME%
    //Note: RGB and NIR images need to be separated into different folders and need to have the exact same name 

    LOG_MESSAGE Define Parameter

    // Define Root Folder of Project Export

    DEFINE_VAR NAME="RGB_DIR" PROMPT=DIR ABORT_ON_CANCEL=YES PROMPT_TEXT="RGB Image Directory"
    DEFINE_VAR NAME="NIR_DIR" PROMPT=DIR ABORT_ON_CANCEL=YES PROMPT_TEXT="NIR Image Directory"
    DEFINE_VAR NAME="RGBN_DIR" PROMPT=DIR ABORT_ON_CANCEL=YES PROMPT_TEXT="RGBN Output Directory"  

    // Importing Images

    LOG_MESSAGE <%TIME%> Start Importing Images

    IMPORT_DIR_TREE DIRECTORY="%RGB_DIR%" \
    TYPE="GEOTIFF" LABEL_FIELD_FORCE_OVERWRITE="NO" CLIP_COLLAR="NONE" SAMPLING_METHOD="NEAREST_NEIGHBOR" \
    AUTO_CONTRAST="NO" CONTRAST_SHARED="YES" CONTRAST_MODE="NONE" TEXTURE_MAP="NO" LAYER_DESC="RGB_IMAGES" LAYER_GROUP="RGB Images"
       
      IMPORT_DIR_TREE DIRECTORY="%NIR_DIR%" \
    TYPE="GEOTIFF" LABEL_FIELD_FORCE_OVERWRITE="NO" CLIP_COLLAR="NONE" SAMPLING_METHOD="NEAREST_NEIGHBOR" \
    AUTO_CONTRAST="NO" CONTRAST_SHARED="YES" CONTRAST_MODE="NONE" TEXTURE_MAP="NO" LAYER_DESC="NIR_IMAGES" LAYER_GROUP="NIR Images"
       
    // Looping through folders and merging bands

      LOG_MESSAGE <%TIME%> Merging Bands  
      
      DIR_LOOP_START DIRECTORY="%RGB_DIR%" 
        DEFINE_VAR NAME="CURRENT_RGB_FNAME" VALUE = "%FNAME%"
        DEFINE_VAR NAME="CURRENT_RGB_FNAME_W_DIR" VALUE = "%FNAME_W_DIR%"

        DIR_LOOP_START DIRECTORY="%NIR_DIR%" 
          DEFINE_VAR NAME="CURRENT_NIR_FNAME" VALUE = "%FNAME%"
          DEFINE_VAR NAME="CURRENT_NIR_FNAME_W_DIR" VALUE = "%FNAME_W_DIR%"
               
          IF COMPARE_STR="%CURRENT_RGB_FNAME%!=%CURRENT_NIR_FNAME%"
          
          ELSE
          
            EXPORT_RASTER FILENAME="%RGBN_DIR%%CURRENT_NIR_FNAME%" TYPE="GEOTIFF" NUM_BANDS=4 PALETTE="MULTIBAND" BAND_BIT_DEPTH=8 \ 
             BAND_EXPORT_SETUP="1?1?%CURRENT_RGB_FNAME_W_DIR%" \
             BAND_EXPORT_SETUP="2?2?%CURRENT_RGB_FNAME_W_DIR%" \
             BAND_EXPORT_SETUP="3?3?%CURRENT_RGB_FNAME_W_DIR%" \
             BAND_EXPORT_SETUP="4?1?%CURRENT_NIR_FNAME_W_DIR%" 
             
          END_IF

     DIR_LOOP_END
    DIR_LOOP_END

    LOG_MESSAGE Export took %TIME_SINCE_LAST_LOG%

    UNLOAD_ALL
Sign In or Register to comment.