-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3121db
commit ed88cac
Showing
4 changed files
with
101 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
CC = g++ | ||
CFLAGS = -g -Wall | ||
|
||
SRC = main.cpp \ | ||
modules/lane-detector/lane_detector.cpp \ | ||
modules/pedestrian-detector/pedestrian_detector.cpp \ | ||
modules/stopping-distance-calculator/stopping_distance_calculator.cpp | ||
|
||
EXE = main.exe | ||
|
||
# C:\opencv\build\x86\install\x86\mingw\lib | ||
LIB = -llibopencv_calib3d310 \ | ||
-llibopencv_core310 \ | ||
-llibopencv_features2d310 \ | ||
-llibopencv_flann310 \ | ||
-llibopencv_highgui310 \ | ||
-llibopencv_imgcodecs310 \ | ||
-llibopencv_imgproc310 \ | ||
-llibopencv_ml310 \ | ||
-llibopencv_objdetect310 \ | ||
-llibopencv_photo310 \ | ||
-llibopencv_shape310 \ | ||
-llibopencv_stitching310 \ | ||
-llibopencv_superres310 \ | ||
-llibopencv_video310 \ | ||
-llibopencv_videoio310 \ | ||
-llibopencv_videostab310 | ||
|
||
OPENCV = -I"C:\opencv\build\x86\install\include" \ | ||
-L"C:\opencv\build\x86\install\x86\mingw\lib" | ||
|
||
$(EXE) : $(SRC) | ||
$(CC) $(CFLAGS) -o $(EXE) $(SRC) $(OPENCV) $(LIB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#include <opencv2\opencv.hpp> | ||
#include <iostream> | ||
|
||
#include "modules/lane-detector/lane_detector.h" | ||
#include "modules/pedestrian-detector/pedestrian_detector.h" | ||
#include "modules/stopping-distance-calculator/stopping_distance_calculator.h" | ||
|
||
#define LANE_COLOR Scalar(0, 255, 0) | ||
|
||
using namespace std; | ||
using namespace cv; | ||
|
||
int main(int argc, const char** argv) | ||
{ | ||
Mat in; | ||
vector<Vec4i> lanes; | ||
vector<Rect> pedestrians; | ||
bool is_out_of_lane = false, | ||
is_distance_safe = true, | ||
contains_pedestrian = false; | ||
|
||
in = imread("1.png"); | ||
|
||
LaneDetector* lane_detector = new LaneDetector(in); | ||
PedestrianDetector* pedestrian_detector = new PedestrianDetector(); | ||
|
||
while (true) { | ||
|
||
in = imread("1.png"); | ||
|
||
// Stopping Distance Calculator Module | ||
is_distance_safe = StoppingDistanceCalculator::IsSafe(in); | ||
if (!is_distance_safe) { | ||
cout << "NOT SAFE" << endl; | ||
} | ||
#if 0 | ||
// Pedestrian Detector Module | ||
contains_pedestrian = pedestrian_detector->ContainsPedestrian(in); | ||
if (contains_pedestrian) { | ||
pedestrians = pedestrian_detector->GetBoundingRectangles(in); | ||
} | ||
#endif | ||
// Lane Detector Module | ||
lanes = lane_detector->GetLanes(in); | ||
is_out_of_lane = lane_detector->IsOutOfLane(in); | ||
lane_detector->DrawLanes(in, lanes, LANE_COLOR, 3); | ||
|
||
|
||
imshow("PROJECT", in); | ||
waitKey(10); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters