Skip to content

Commit 0c0f732

Browse files
Img_processing: add detect sun flag
1 parent b6873ed commit 0c0f732

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

img_processing/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ if(LANE_DETECT)
2323
add_definitions(-DLANE_DETECT)
2424
endif()
2525

26+
# Check if DETECT_SUN flag is set
27+
option(DETECT_SUN "detect sun" ON)
28+
if(DETECT_SUN)
29+
add_definitions(-DDETECT_SUN)
30+
endif()
31+
2632
# make the library with the src files
2733
file(GLOB SOURCES "src/*.cpp" "../logger/*.cpp" "tests/utils.cpp" "../communication/src/*.cpp" "../communication/sockets/*.cpp")
2834
add_library(ImageProcessingLib ${SOURCES})

img_processing/src/manager.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ int Manager::processing(const Mat &newFrame, bool isTravel)
166166
// add distance to detection objects
167167
distance.findDistance(this->currentOutput);
168168
velocity.returnVelocities(this->currentOutput);
169-
sunDetector.detectSun(this->currentFrame);
169+
#ifdef DETECT_SUN
170+
sunDetector.detectSun(this->currentFrame);
171+
#endif
170172
// send allerts to main control
171173
vector<vector<uint8_t>> alerts = alerter.sendAlerts(this->currentOutput);
172174
sendAlerts(alerts);
@@ -258,8 +260,9 @@ void Manager::drawOutput()
258260
Point(legendX + 10, legendY + 55), Scalar(255, 0, 0), FILLED);
259261
putText(*currentFrame, "velocity", Point(legendX + 15, legendY + 50),
260262
FONT_HERSHEY_SIMPLEX, 0.6, Scalar(255, 255, 255), 1);
261-
262-
sunDetector.drowSun(this->currentFrame);
263+
#ifdef DETECT_SUN
264+
sunDetector.drowSun(this->currentFrame);
265+
#endif
263266

264267
#ifdef LANE_DETECT
265268
laneDetector.drawLanesOnImage(currentFrame);

0 commit comments

Comments
 (0)