#include "stdafx.h" #include "ImageOperatorBase.h" #include "BaseTool.h" #include "GeoOperator.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "FileOperator.h" #include #include #include #include #include #include #include #include #include // OGRSpatialReference 用于空间参考转换 #include // 用于 GDALWarp 操作 void testOutAmpArr(QString filename, float* amp, long rowcount, long colcount) { Eigen::MatrixXd h_amp_img = Eigen::MatrixXd::Zero(rowcount, colcount); for (long hii = 0; hii < rowcount; hii++) { for (long hjj = 0; hjj < colcount; hjj++) { h_amp_img(hii, hjj) = amp[hii * colcount + hjj]; } } QString ampPath = getDebugDataPath(filename); saveEigenMatrixXd2Bin(h_amp_img, ampPath); qDebug() << filename.toLocal8Bit().constData(); qDebug() << "max:\t" << h_amp_img.maxCoeff(); qDebug() << "min:\t" << h_amp_img.minCoeff(); } void testOutAmpArr(QString filename, double* amp, long rowcount, long colcount) { Eigen::MatrixXd h_amp_img = Eigen::MatrixXd::Zero(rowcount, colcount); for (long hii = 0; hii < rowcount; hii++) { for (long hjj = 0; hjj < colcount; hjj++) { h_amp_img(hii, hjj) = amp[hii * colcount + hjj]; } } QString ampPath = getDebugDataPath(filename); saveEigenMatrixXd2Bin(h_amp_img, ampPath); qDebug() << filename.toLocal8Bit().constData(); qDebug() << "max:\t" << h_amp_img.maxCoeff(); qDebug() << "min:\t" << h_amp_img.minCoeff(); } void testOutClsArr(QString filename, long* amp, long rowcount, long colcount) { Eigen::MatrixXd h_amp_img = Eigen::MatrixXd::Zero(rowcount, colcount); for (long hii = 0; hii < rowcount; hii++) { for (long hjj = 0; hjj < colcount; hjj++) { h_amp_img(hii, hjj) = amp[hii * colcount + hjj]; } } QString ampPath = getDebugDataPath(filename); saveEigenMatrixXd2Bin(h_amp_img, ampPath); qDebug() << filename.toLocal8Bit().constData(); qDebug() << "max:\t" << h_amp_img.maxCoeff(); qDebug() << "min:\t" << h_amp_img.minCoeff(); } void testOutComplexDoubleArr(QString filename, std::complex* data, long rowcount, long colcount) { QString ampPath = getDebugDataPath(filename); gdalImageComplex compleximg = CreateEchoComplex(ampPath, rowcount, colcount, 1); compleximg.saveImage(data, 0, 0, rowcount, colcount, 1); return; } void testOutDataArr(QString filename, double* data, long rowcount, long colcount) { return testOutAmpArr(filename, data, rowcount, colcount); } void testOutDataArr(QString filename, float* data, long rowcount, long colcount) { return testOutAmpArr(filename, data, rowcount, colcount); } void testOutDataArr(QString filename, long* data, long rowcount, long colcount) { return testOutClsArr(filename, data, rowcount, colcount); } void testOutAntPatternTrans(QString antpatternfilename, double* antPatternArr, double starttheta, double deltetheta, double startphi, double deltaphi, long thetanum, long phinum) { Eigen::MatrixXd antPatternMatrix(thetanum, phinum); for (long t = 0; t < thetanum; ++t) { for (long p = 0; p < phinum; ++p) { long index = t * phinum + p; if (index < thetanum * phinum) { antPatternMatrix(t, p) = static_cast(antPatternArr[index]); // Copy to Eigen matrix } } } Eigen::MatrixXd gt(2, 3); gt(0, 0) = startphi;//x gt(0, 1) = deltaphi; gt(0, 2) = 0; gt(1, 0) = starttheta; gt(1, 1) = 0; gt(1, 2) = deltetheta; QString antpatternfilepath = getDebugDataPath(antpatternfilename); gdalImage ds = CreategdalImageDouble(antpatternfilepath, thetanum, phinum, 1, gt, "", true, true, true); ds.saveImage(antPatternMatrix, 0, 0, 1); }