資源簡介
可以進行遙感影像的讀取,然后對其進行添加了最小距離的分類方法以及NDVI的計算、bp分類、ppi端元提取,代碼的整體系很強,可以進行隨意的添加以及修改。
代碼片段和文件信息
//?BandMath.cpp:?implementation?of?the?CBandMath?class.
//
//////////////////////////////////////////////////////////////////////
#include?“stdafx.h“
#include?“bsqview.h“
#include?“BandMath.h“
#ifdef?_DEBUG
#undef?THIS_FILE
static?char?THIS_FILE[]=__FILE__;
#define?new?DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
//?Construction/Destruction
//////////////////////////////////////////////////////////////////////
CBandMath::CBandMath()
{
}
CBandMath::~CBandMath()
{
}
void?CBandMath::NDVICacu(CString?m_pathnameint?Bandsint?Widthint?Heightint?DataType)
{
int?fRedfNearRed;
if(DataType==1)//TM
{
fRed=3;?
fNearRed=5;
}
CString?m_OutFile;
float?*NDVIWr?=?new?float[Height*Width];
unsigned?char?*Red?????????=?new?unsigned?char[Height*Width];
unsigned?char?*NearRed?????=?new?unsigned?char[Height*Width];
CFile?fReadFilefWriteFile;
if(!fReadFile.Open(m_pathnameCFile::modeReadWrite))????????????//打開圖像文件(參數)
{
AfxMessageBox(“不能打開所讀文件!“);??
return;
}????
//打開寫入文件(其它類的變量)
if(!fWriteFile.Open(“001“CFile::modeCreate|CFile::modeWrite))
{
AfxMessageBox(“請選擇輸出文件!“);??
return;
}
fReadFile.Seek((fRed-1)*Height*WidthCFile::begin);
fReadFile.Read(RedHeight*Width);
fReadFile.Seek((fNearRed-1)*Height*WidthCFile::begin);
fReadFile.Read(NearRedHeight*Width);??????????
for(int?k=0;k NDVIWr[k]=((float)NearRed[k]-Red[k])/(NearRed[k]+Red[k]);
fWriteFile.Write(NDVIWrsizeof(float)*Height*Width);
delete?[]NDVIWr;???????????????
delete?[]Red?;??????
delete?[]NearRed?;??
fReadFile.Close();
fWriteFile.Close();
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-05-25?18:52??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\
?????文件????????1755??2018-04-10?22:14??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BandMath.cpp
?????文件?????????591??2018-04-10?16:58??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BandMath.h
?????文件???????12611??2018-05-25?17:51??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BigImageDlg.cpp
?????文件????????2808??2018-05-25?18:06??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BigImageDlg.h
?????文件???????12857??2018-05-25?17:25??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BPANN.cpp
?????文件????????3534??2018-05-25?17:25??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BPANN.h
?????文件???????46788??2018-05-25?18:03??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqView.aps
?????文件????????7547??2018-05-25?18:52??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqView.clw
?????文件????????4407??2003-01-14?14:43??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqView.cpp
?????文件????????5923??2018-05-25?17:57??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqView.dsp
?????文件?????????539??2002-12-16?17:07??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqView.dsw
?????文件????????1367??2002-12-16?17:07??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqView.h
?????文件??????541696??2018-05-25?18:52??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqView.ncb
?????文件???????52736??2018-05-25?18:52??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqView.opt
?????文件????????4557??2018-05-25?18:06??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqView.plg
?????文件???????20551??2018-05-25?15:48??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqView.rc
?????文件????85598208??2018-04-02?11:33??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqView.sdf
?????文件???????18944??2018-04-02?11:33??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqView.suo
?????文件????????1762??2002-12-16?17:07??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqViewDoc.cpp
?????文件????????1486??2002-12-16?17:07??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqViewDoc.h
?????文件???????27314??2018-05-25?17:48??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqViewView.cpp
?????文件????????4450??2018-05-25?15:37??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\BsqViewView.h
?????文件????????1538??2003-02-26?15:13??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\ChildFrm.cpp
?????文件????????1397??2002-12-16?17:07??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\ChildFrm.h
?????文件????????5439??2003-04-16?11:28??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\ChooseAreas.cpp
?????文件????????1400??2003-04-16?11:28??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\ChooseAreas.h
?????文件????????2821??2003-03-04?16:08??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\ClassSelectDlg.cpp
?????文件????????1455??2003-03-04?16:05??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\ClassSelectDlg.h
?????目錄???????????0??2018-05-25?18:06??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\Debug\
?????文件????????9465??2018-05-25?18:06??Bsqview原型+加入NDVI+加入最小距離法+Kmeans+PPI\Debug\BandMath.obj
............此處省略78個文件信息
評論
共有 條評論