资源简介

波段合成,将单波段数据拼接成多波段数据,并且添加批处理功能

资源截图

代码片段和文件信息

/***************************************************************************
*
* Time: 2018-1-24
* Project:  影像的基本处理
* Purpose:  影像的基本处理过程,便于以后使用
* Author:  王凯
* Copyright (c) 2018
* Describe: 影像的基本处理,包括投影转换、拼接、裁剪、波段合成
*
****************************************************************************/
#pragma once
#include “baseProcess.h“

baseProcess::baseProcess()
{

}
baseProcess::~baseProcess()
{

}

/**
* @brief   合并文件,将单波段文件合并成一个多波段文件
* @param   sInfleVector  待合并的文件集合
* @param   sOutFile      输出文件
* @return  返回值:表示计算过程中出现的各种错误信息
*/
int baseProcess::iImageBandMerge(vectorsInfleVector string sOutFile)
{
GDALAllRegister();
CPLSetConfigOption(“GDAL_FILENAME_IS_UTF8““NO“);

struct InfoStruct stInfo;
getImageInfo cGetInfo;
cGetInfo.iGetInfo(sInfleVector[0].c_str()&stInfo);

//创建存放结果影像的数据集;
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName(“GTiff“);
GDALDataset* poSaveDataset = poDriver->Create(sOutFile.c_str()stInfo.iXSize stInfo.iYSize  sInfleVector.size() stInfo.iDataType  NULL); 


//int ** ipoDataset = new int[sInfleVector.size()];

vectorvecDatasets;
for (int i = 0; i  {
GDALDataset * poDataset = (GDALDataset*)GDALOpen(sInfleVector[i].c_str()GA_ReadOnly);
vecDatasets.push_back(poDataset);
}
int * idata = new int[stInfo.iXSize];
memset(idata0sizeof(int)*stInfo.iXSize);
for (int j = 0 ;j {
for (int i = 0;i {
vecDatasets[i]->RasterIO(GF_Read0jstInfo.iXSize1idatastInfo.iXSize1stInfo.iDataType10000);
poSaveDataset->GetRasterBand(i+1)->SetNoDataValue(0.0);
poSaveDataset->GetRasterBand(i+1)->RasterIO(GF_Write0jstInfo.iXSize1idatastInfo.iXSize1stInfo.iDataType00);
}
}
poSaveDataset->SetGeoTransform(stInfo.dGeotransform);  
poSaveDataset->SetProjection(stInfo.cProjWkt); 
for (int i= 0;i {
GDALClose(vecDatasets[i]);
}
vecDatasets.clear();
delete [] idata;
GDALClose(poSaveDataset);
return 0;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4085  2018-01-25 20:56  BandMergeForTiff\BandMergeForTiff\BandMergeForTiff.vcxproj

     文件       1897  2018-01-25 20:56  BandMergeForTiff\BandMergeForTiff\BandMergeForTiff.vcxproj.filters

     文件        143  2018-01-24 14:36  BandMergeForTiff\BandMergeForTiff\BandMergeForTiff.vcxproj.user

     文件       2210  2018-01-24 20:56  BandMergeForTiff\BandMergeForTiff\baseProcess.cpp

     文件        605  2018-01-24 16:01  BandMergeForTiff\BandMergeForTiff\baseProcess.h

     文件       1620  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Cbatch.cpp

     文件        656  2018-01-25 20:57  BandMergeForTiff\BandMergeForTiff\Cbatch.h

     文件       4120  2016-11-22 09:21  BandMergeForTiff\BandMergeForTiff\CBrowseDir.cpp

     文件       1454  2016-11-22 09:21  BandMergeForTiff\BandMergeForTiff\CBrowseDir.h

     文件       1010  2016-11-22 09:21  BandMergeForTiff\BandMergeForTiff\CStatDir.h

     文件       1691  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\BandMergeForTiff.Build.CppClean.log

     文件        381  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\BandMergeForTiff.exe.intermediate.manifest

     文件         62  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\BandMergeForTiff.lastbuildstate

     文件      13186  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\BandMergeForTiff.log

     文件        331  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\BandMergeForTiff.write.1.tlog

     文件     861709  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\baseProcess.obj

     文件     958874  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\Cbatch.obj

     文件     276914  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\CBrowseDir.obj

     文件       3464  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\cl.command.1.tlog

     文件      54810  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\CL.read.1.tlog

     文件       2754  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\CL.write.1.tlog

     文件     773529  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\GetImageInfo.obj

     文件       2152  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\link.command.1.tlog

     文件       4212  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\link.read.1.tlog

     文件       1304  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\link.write.1.tlog

     文件     772081  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\main.obj

     文件        528  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\mt.command.1.tlog

     文件        706  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\mt.read.1.tlog

     文件        334  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\mt.write.1.tlog

     文件     510976  2018-01-25 20:58  BandMergeForTiff\BandMergeForTiff\Debug\vc100.idb

............此处省略47个文件信息

评论

共有 条评论