1 Star 0 Fork 1

ctguhzy/GeoTiffTools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
AreaIntegrator.hxx 1.53 KB
一键复制 编辑 原始数据 按行查看 历史
ctguhzy 提交于 2022-05-02 00:03 +08:00 . Added AreaIntegrator.
#ifndef _AREA_INTEGRATOR_HXX_
#define _AREA_INTEGRATOR_HXX_
#include <vector>
#include <map>
#include "GeoTiffImage.hxx"
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <opencv2/opencv.hpp>
#include <string.h>
struct AILabel
{
int Index;
std::string Name;
double Area;
AILabel()
{
Index = 0;
Name = "None";
Area = 0.0;
}
AILabel(int idx, std::string name)
{
Index = idx;
Name = name;
Area = 0.0;
}
};
class AreaIntegrator
{
public:
AreaIntegrator();
inline void setLabelFile(const char* labelFile) { strcpy(_labelFileName, labelFile); }
inline void setDEMFile(const char* demFile) { strcpy(_demFileName, demFile); }
inline void setOrthFile(const char* orthoFile) { strcpy(_orthoFileName, orthoFile); }
inline void addLabel(AILabel label ) { _labels[label.Index] = label; }
inline std::map<int, AILabel> getLabels() { return _labels; }
public:
bool computeAreas();
private:
void computeLabelAreas();
double computePixelArea(const int ix, const int iy, const double* upperRow, const double* centerRow, const double* lowerRow);
double getDEMValue(float px, float py);
void computeDEMRows(int rowIdx, double* upperRow, double* centerRow, double* lowerRow);
private:
std::map<int, AILabel> _labels;
char _labelFileName[256];
char _demFileName[256];
char _orthoFileName[256];
GeoTiffImage* _orthoImage;
GeoTiffImage* _demImage;
cv::Mat _labelImage;
cv::Mat _labelPalette;
};
#endif
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/ctguhzy/GeoTiffTools.git
git@gitee.com:ctguhzy/GeoTiffTools.git
ctguhzy
GeoTiffTools
GeoTiffTools
master

搜索帮助