Skip to content

Commit 4faaac4

Browse files
authored
Merge pull request #40 from Digitelektro/develop
Develop
2 parents 8d1c852 + 9a0eba2 commit 4faaac4

13 files changed

Lines changed: 796 additions & 186 deletions

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ ExternalProject_Add(libcorrect
3939
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
4040
)
4141

42-
find_package(OpenCV REQUIRED PATHS "D:/Programozas/opencv/own_build/install/")
42+
find_package(OpenCV)
4343

4444
link_directories(
4545
${CMAKE_BINARY_DIR}/sgp4-build/libsgp4
4646
${CMAKE_BINARY_DIR}/libcorrect-build/lib
4747
)
4848

49-
add_definitions(-D_USE_MATH_DEFINES)
49+
add_definitions(-D_USE_MATH_DEFINES -D_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING)
5050

5151
add_executable(meteordemod
5252
main.cpp
@@ -124,12 +124,14 @@ if(WIN32)
124124
${OpenCV_LIBS}
125125
sgp4.lib
126126
correct.lib
127+
stdc++fs
127128
)
128129
else()
129130
target_link_libraries(meteordemod
130131
${OpenCV_LIBS}
131132
sgp4.a
132133
correct.a
134+
stdc++fs
133135
)
134136
endif()
135137

@@ -148,8 +150,8 @@ if(UNIX AND NOT APPLE)
148150
if (DEBIAN_FOUND)
149151
SET(CPACK_GENERATOR "DEB")
150152
SET(CPACK_PACKAGE_VERSION_MAJOR "2")
151-
SET(CPACK_PACKAGE_VERSION_MINOR "3")
152-
SET(CPACK_PACKAGE_VERSION_PATCH "1")
153+
SET(CPACK_PACKAGE_VERSION_MINOR "4")
154+
SET(CPACK_PACKAGE_VERSION_PATCH "0")
153155
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Digitelektro")
154156
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/Digitelektro/MeteorDemod")
155157
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Russian Meteor M2 weather satellite data decoder")

GIS/shaperenderer.cpp

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void GIS::ShapeRenderer::setTextFieldName(const std::string &name)
2525
mTextFieldName = name;
2626
}
2727

28-
void GIS::ShapeRenderer::drawShapeMercator(cv::Mat &src, float xStart, float yStart)
28+
void GIS::ShapeRenderer::drawShapeMercator(cv::Mat &src, float xStart, float yStart, float scale)
2929
{
3030
if(!load()) {
3131
return;
@@ -43,7 +43,7 @@ void GIS::ShapeRenderer::drawShapeMercator(cv::Mat &src, float xStart, float ySt
4343
for(polyLineIterator->begin(); *polyLineIterator != polyLineIterator->end(); ++(*polyLineIterator)) {
4444
//std::cout << polyLineIterator->point.x << " " << polyLineIterator->point.y << std::endl;
4545

46-
PixelGeolocationCalculator::CartesianCoordinateF coordinate = PixelGeolocationCalculator::coordinateToMercatorProjection(polyLineIterator->point.y, polyLineIterator->point.x, mEarthRadius + mAltitude);
46+
PixelGeolocationCalculator::CartesianCoordinateF coordinate = PixelGeolocationCalculator::coordinateToMercatorProjection<float>({polyLineIterator->point.y, polyLineIterator->point.x, 0}, mEarthRadius + mAltitude, scale);
4747

4848
coordinate.x += -xStart;
4949
coordinate.y += -yStart;
@@ -65,7 +65,7 @@ void GIS::ShapeRenderer::drawShapeMercator(cv::Mat &src, float xStart, float ySt
6565
for(recordIterator->begin(); *recordIterator != recordIterator->end(); ++(*recordIterator)) {
6666
ShapeReader::Point point(*recordIterator);
6767

68-
PixelGeolocationCalculator::CartesianCoordinateF coordinate = PixelGeolocationCalculator::coordinateToMercatorProjection(point.y, point.x, mEarthRadius + mAltitude);
68+
PixelGeolocationCalculator::CartesianCoordinateF coordinate = PixelGeolocationCalculator::coordinateToMercatorProjection<float>({point.y, point.x, 0}, mEarthRadius + mAltitude, scale);
6969
coordinate.x += -xStart;
7070
coordinate.y += -yStart;
7171

@@ -83,7 +83,7 @@ void GIS::ShapeRenderer::drawShapeMercator(cv::Mat &src, float xStart, float ySt
8383
ShapeReader::Point point(*recordIterator);
8484
std::vector<std::string> fieldValues = dbFilereader.getFieldValues(i);
8585

86-
PixelGeolocationCalculator::CartesianCoordinateF coordinate = PixelGeolocationCalculator::coordinateToMercatorProjection(point.y, point.x, mEarthRadius + mAltitude);
86+
PixelGeolocationCalculator::CartesianCoordinateF coordinate = PixelGeolocationCalculator::coordinateToMercatorProjection<float>({point.y, point.x, 0}, mEarthRadius + mAltitude, scale);
8787
coordinate.x += -xStart;
8888
coordinate.y += -yStart;
8989

@@ -124,7 +124,7 @@ void GIS::ShapeRenderer::drawShapeMercator(cv::Mat &src, float xStart, float ySt
124124
}
125125
}
126126

127-
void GIS::ShapeRenderer::drawShapeEquidistant(cv::Mat &src, float xStart, float yStart, float centerLatitude, float centerLongitude)
127+
void GIS::ShapeRenderer::drawShapeEquidistant(cv::Mat &src, float xStart, float yStart, float centerLatitude, float centerLongitude, float scale)
128128
{
129129
if(!load()) {
130130
return;
@@ -142,7 +142,7 @@ void GIS::ShapeRenderer::drawShapeEquidistant(cv::Mat &src, float xStart, float
142142
for(polyLineIterator->begin(); *polyLineIterator != polyLineIterator->end(); ++(*polyLineIterator)) {
143143
//std::cout << polyLineIterator->point.x << " " << polyLineIterator->point.y << std::endl;
144144

145-
PixelGeolocationCalculator::CartesianCoordinateF coordinate = PixelGeolocationCalculator::coordinateToAzimuthalEquidistantProjection(polyLineIterator->point.y, polyLineIterator->point.x, centerLatitude, centerLongitude, mEarthRadius + mAltitude);
145+
PixelGeolocationCalculator::CartesianCoordinateF coordinate = PixelGeolocationCalculator::coordinateToAzimuthalEquidistantProjection<float>({polyLineIterator->point.y, polyLineIterator->point.x, 0}, {centerLatitude, centerLongitude, 0}, mEarthRadius + mAltitude, scale);
146146

147147
coordinate.x += -xStart;
148148
coordinate.y += -yStart;
@@ -166,7 +166,7 @@ void GIS::ShapeRenderer::drawShapeEquidistant(cv::Mat &src, float xStart, float
166166
for(recordIterator->begin(); *recordIterator != recordIterator->end(); ++(*recordIterator)) {
167167
ShapeReader::Point point(*recordIterator);
168168

169-
PixelGeolocationCalculator::CartesianCoordinateF coordinate = PixelGeolocationCalculator::coordinateToAzimuthalEquidistantProjection(point.y, point.x, centerLatitude, centerLongitude, mEarthRadius + mAltitude);
169+
PixelGeolocationCalculator::CartesianCoordinateF coordinate = PixelGeolocationCalculator::coordinateToAzimuthalEquidistantProjection<float>({point.y, point.x, 0}, {centerLatitude, centerLongitude, 0}, mEarthRadius + mAltitude, scale);
170170
coordinate.x += -xStart;
171171
coordinate.y += -yStart;
172172

@@ -188,7 +188,7 @@ void GIS::ShapeRenderer::drawShapeEquidistant(cv::Mat &src, float xStart, float
188188
ShapeReader::Point point(*recordIterator);
189189
std::vector<std::string> fieldValues = dbFilereader.getFieldValues(i);
190190

191-
PixelGeolocationCalculator::CartesianCoordinateF coordinate = PixelGeolocationCalculator::coordinateToAzimuthalEquidistantProjection(point.y, point.x, centerLatitude, centerLongitude, mEarthRadius + mAltitude);
191+
PixelGeolocationCalculator::CartesianCoordinateF coordinate = PixelGeolocationCalculator::coordinateToAzimuthalEquidistantProjection<float>({point.y, point.x, 0}, {centerLatitude, centerLongitude, 0}, mEarthRadius + mAltitude, scale);
192192
coordinate.x += -xStart;
193193
coordinate.y += -yStart;
194194

@@ -235,36 +235,17 @@ void GIS::ShapeRenderer::drawShapeEquidistant(cv::Mat &src, float xStart, float
235235

236236
bool GIS::ShapeRenderer::equidistantCheck(float latitude, float longitude, float centerLatitude, float centerLongitude)
237237
{
238-
bool longResult = true;
239-
bool latResult = true;
240-
241-
int minLongitude = static_cast<int>(centerLongitude - 90);
242-
int maxLongitude = static_cast<int>(centerLongitude + 90);
243-
int minLatitude = static_cast<int>(centerLatitude - 45);
244-
int maxLatitude = static_cast<int>(centerLatitude + 45);
245-
246-
//Normalize
247-
minLongitude = ((minLongitude + 540) % 360 - 180);
248-
maxLongitude = ((maxLongitude + 540) % 360 - 180);
249-
minLatitude = ((minLatitude + 270) % 180 - 90);
250-
maxLatitude = ((maxLatitude + 270) % 180 - 90);
251-
252-
if(maxLatitude < minLatitude)
253-
{
254-
latResult = latitude > minLatitude || latitude < maxLatitude;
255-
}
256-
else
257-
{
258-
latResult = latitude > minLatitude && latitude < maxLatitude;
259-
}
260-
if(maxLongitude < minLongitude)
261-
{
262-
longResult = longitude < minLongitude || longitude < maxLongitude;
263-
}
264-
else
238+
//Degree To radian
239+
latitude = M_PI * latitude / 180.0f;
240+
longitude = M_PI * longitude / 180.0f;
241+
centerLatitude= M_PI * centerLatitude / 180.0f;
242+
centerLongitude= M_PI * centerLongitude / 180.0f;
243+
244+
float deltaSigma = std::sin(centerLatitude) * std::sin(latitude) + std::cos(latitude) * std::cos(longitude - centerLongitude);
245+
if (deltaSigma < 0.0)
265246
{
266-
longResult = longitude > minLongitude && longitude < maxLongitude;
247+
return false;
267248
}
268249

269-
return longResult && latResult;
250+
return true;
270251
}

GIS/shaperenderer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ class ShapeRenderer : public ShapeReader
2020
void addNumericFilter(const std::string name, int value);
2121
void setTextFieldName(const std::string &name);
2222

23-
void drawShapeMercator(cv::Mat &src, float xStart, float yStart);
24-
void drawShapeEquidistant(cv::Mat &src, float xStart, float yStart, float centerLatitude, float centerLongitude);
23+
void drawShapeMercator(cv::Mat &src, float xStart, float yStart, float scale);
24+
void drawShapeEquidistant(cv::Mat &src, float xStart, float yStart, float centerLatitude, float centerLongitude, float scale);
2525

2626
public: //setters
2727
void setThickness(int thickness) {

MeteorDemod.pro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ CONFIG -= app_bundle
77
# deprecated API in order to know how to port your code away from it.
88
DEFINES += QT_DEPRECATED_WARNINGS LIQUID_BUILD_CPLUSPLUS
99
DEFINES +=_USE_MATH_DEFINES
10+
DEFINES += _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
11+
12+
QMAKE_LFLAGS += -lstdc++fs
1013

1114
# You can also make your code fail to compile if it uses deprecated APIs.
1215
# In order to do so, uncomment the following line.

common/settings.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,18 @@ void Settings::parseIni(const std::string &path)
6161
ini::extract(mIniParser.sections["Program"]["RollM2"], mM2Roll, -2.9f);
6262
ini::extract(mIniParser.sections["Program"]["PitchM2"], mM2Pitch, 0.3f);
6363
ini::extract(mIniParser.sections["Program"]["YawM2"], mM2Yaw, 0.0f);
64+
ini::extract(mIniParser.sections["Program"]["TimeOffsetM2"], mTimeOffsetM2Sec, 0);
6465
ini::extract(mIniParser.sections["Program"]["NightPassTreshold"], mNightPassTreshold, 10.0f);
66+
ini::extract(mIniParser.sections["Program"]["ProjectionScale"], mProjectionScale, 0.75f);
67+
ini::extract(mIniParser.sections["Program"]["CompositeProjectionScale"], mCompositeProjectionScale, 0.75f);
68+
ini::extract(mIniParser.sections["Program"]["CompositeAzimuthalEquidistantProjection"], mCompositeEquadistantProjection, true);
69+
ini::extract(mIniParser.sections["Program"]["CompositeMercatorProjection"], mCompositeMercatorProjection, true);
70+
ini::extract(mIniParser.sections["Program"]["GenerateComposite123"], mGenerateComposite123, true);
71+
ini::extract(mIniParser.sections["Program"]["GenerateComposite125"], mGenerateComposite125, true);
72+
ini::extract(mIniParser.sections["Program"]["GenerateComposite221"], mGenerateComposite221, true);
73+
ini::extract(mIniParser.sections["Program"]["GenerateComposite68"], mGenerateComposite68, true);
74+
ini::extract(mIniParser.sections["Program"]["GenerateCompositeThermal"], mGenerateCompositeThermal, true);
75+
6576

6677
ini::extract(mIniParser.sections["Demodulator"]["CostasBandwidth"], mCostasBw, 50);
6778
ini::extract(mIniParser.sections["Demodulator"]["RRCFilterOrder"], mRRCFilterOrder, 64);

common/settings.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,18 @@ class Settings
113113
bool spreadImage() const { return mSpreadImage; }
114114
bool addRainOverlay() const { return mAddRainOverlay; }
115115
float getNightPassTreshold() const { return mNightPassTreshold; }
116+
float getProjectionScale() const {return mProjectionScale; }
117+
float getCompositeProjectionScale() const { return mCompositeProjectionScale; }
118+
119+
bool compositeEquadistantProjection() const { return mCompositeEquadistantProjection; }
120+
bool compositeMercatorProjection() const { return mCompositeMercatorProjection; }
121+
bool generateComposite123() const { return mGenerateComposite123; }
122+
bool generateComposite125() const { return mGenerateComposite125; }
123+
bool generateComposite221() const { return mGenerateComposite221; }
124+
bool generateComposite68() const { return mGenerateComposite68; }
125+
bool generateCompositeThermal() const { return mGenerateCompositeThermal; }
126+
127+
int getTimeOffsetM2Sec() const { return mTimeOffsetM2Sec; }
116128

117129
int getCostasBandwidth() const { return mCostasBw; }
118130
int getRRCFilterOrder() const { return mRRCFilterOrder; }
@@ -170,6 +182,18 @@ class Settings
170182
bool mSpreadImage;
171183
bool mAddRainOverlay;
172184
float mNightPassTreshold;
185+
float mProjectionScale;
186+
float mCompositeProjectionScale;
187+
188+
bool mCompositeEquadistantProjection;
189+
bool mCompositeMercatorProjection;
190+
bool mGenerateComposite123;
191+
bool mGenerateComposite125;
192+
bool mGenerateComposite221;
193+
bool mGenerateComposite68;
194+
bool mGenerateCompositeThermal;
195+
196+
int mTimeOffsetM2Sec;
173197

174198
//ini section: Demodulator
175199
int mCostasBw;

common/version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define VERSION_H
33

44
#define VERSION_MAJOR 2
5-
#define VERSION_MINOR 3
6-
#define VERSION_FIX 1
5+
#define VERSION_MINOR 4
6+
#define VERSION_FIX 0
77

88
#endif // VERSION_H

0 commit comments

Comments
 (0)