-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from JoHeinrich/analysationClasses
Analysation subdirectory added
- Loading branch information
Showing
13 changed files
with
554 additions
and
21 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
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
// | ||
// element.cpp | ||
|
||
// Projectname: amos-ss16-proj5 | ||
// | ||
// Created on 02.06.2016. | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
project( analyser ) | ||
set (OUTPUT_NAME analyser) | ||
|
||
|
||
|
||
set(sources | ||
analyser.cpp | ||
scenario.cpp | ||
humans_in_front_of_bus_scenario.cpp | ||
main.cpp | ||
../ObjectDetection/element.cpp | ||
../ObjectDetection/frame_detection_data.cpp | ||
|
||
) | ||
|
||
set(headers | ||
analyser.h | ||
scenario.h | ||
humans_in_front_of_bus_scenario.h | ||
../ObjectDetection/element.h | ||
../ObjectDetection/frame_detection_data.h | ||
|
||
|
||
) | ||
add_executable( ${OUTPUT_NAME} ${sources} ${header} ) |
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,67 @@ | ||
// | ||
// hdf_reader.cpp | ||
// Projectname: amos-ss16-proj5 | ||
// | ||
// Created on 10.05.2016. | ||
// Copyright (c) 2016 de.fau.cs.osr.amos2016.gruppe5 | ||
// | ||
// This file is part of the AMOS Project 2016 @ FAU | ||
// (Friedrich-Alexander University Erlangen-Nürnberg) | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as | ||
// published by the Free Software Foundation, either version 3 of the | ||
// License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public | ||
// License along with this program. If not, see | ||
// <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
//std | ||
#include <iostream> | ||
|
||
#include "analyser.h" | ||
|
||
//object detection | ||
#include "../ObjectDetection/element.h" | ||
|
||
|
||
//std | ||
#include <list> | ||
|
||
Analyser::Analyser(std::vector<Scenario *> scenarios){ | ||
|
||
all_scenarios_ = scenarios; | ||
|
||
} | ||
|
||
void Analyser::AddScenario(Scenario* scenario){ | ||
|
||
all_scenarios_.push_back(scenario); | ||
|
||
} | ||
|
||
Scenario* Analyser::Analyse(FrameDetectionData detected_objects){ | ||
|
||
// iterate over all scenarios and return the first detected scenario | ||
for(int i = 0; i < all_scenarios_.size(); i++){ | ||
|
||
Scenario* current_scenario = all_scenarios_.at(i); | ||
|
||
bool detected = current_scenario->Detect(detected_objects); | ||
|
||
if(detected){ | ||
std::cout << "Analyser: A scenario was detected! " <<std::endl; | ||
return current_scenario; | ||
} | ||
} | ||
|
||
return NULL; | ||
|
||
} |
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,70 @@ | ||
|
||
// | ||
// analyser.h | ||
// Projectname: amos-ss16-proj5 | ||
// | ||
// Created on 03.06.2016. | ||
// Copyright (c) 2016 de.fau.cs.osr.amos2016.gruppe5 | ||
// | ||
// This file is part of the AMOS Project 2016 @ FAU | ||
// (Friedrich-Alexander University Erlangen-Nürnberg) | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as | ||
// published by the Free Software Foundation, either version 3 of the | ||
// License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public | ||
// License along with this program. If not, see | ||
// <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
#ifndef ANALYSER_H | ||
#define ANALYSER_H | ||
|
||
//std | ||
#include <vector> | ||
|
||
#include "../ObjectDetection/frame_detection_data.h" | ||
#include "scenario.h" | ||
#include "humans_in_front_of_bus_scenario.h" | ||
|
||
class Analyser { | ||
|
||
public: | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param scenarios The vector with the possible scenarios | ||
*/ | ||
Analyser(std::vector<Scenario*> scenarios); | ||
|
||
/** | ||
* Adds a scenario to the vector with analysed scenarios. | ||
* | ||
* @param scenario The scenario to add. | ||
*/ | ||
void AddScenario(Scenario* scenario); | ||
|
||
/** | ||
* Analyses the frame detection data and detetermines which scenario is there | ||
* | ||
* @param detected_objects The frame data with detected objects | ||
* @return The detected scenario | ||
*/ | ||
Scenario* Analyse(FrameDetectionData detected_objects); | ||
|
||
private: | ||
|
||
std::vector<Scenario*> all_scenarios_; ///< Vector with all possible scenarios | ||
|
||
}; | ||
|
||
|
||
#endif // ANALYSER_H |
71 changes: 71 additions & 0 deletions
71
src/ScenarioAnalysation/humans_in_front_of_bus_scenario.cpp
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,71 @@ | ||
|
||
// Projectname: amos-ss16-proj5 | ||
// | ||
// Created on 10.05.2016. | ||
// Copyright (c) 2016 de.fau.cs.osr.amos2016.gruppe5 | ||
// | ||
// This file is part of the AMOS Project 2016 @ FAU | ||
// (Friedrich-Alexander University Erlangen-Nürnberg) | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as | ||
// published by the Free Software Foundation, either version 3 of the | ||
// License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public | ||
// License along with this program. If not, see | ||
// <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
//std | ||
#include <iostream> | ||
|
||
#include "humans_in_front_of_bus_scenario.h" | ||
|
||
bool HumansInFrontOfBusScenario::Detect(FrameDetectionData detected_objects){ | ||
|
||
// first: check whether there are humans detected | ||
|
||
std::list<Element> humans = detected_objects.GetElementsOfType(OBJECT_HUMAN); | ||
std::list<Element> vehicles = detected_objects.GetElementsOfType(OBJECT_VEHICLE); | ||
|
||
std:: cout << "Humans in Front of Bus Scenario: Number of humans = " << humans.size() << " Number of vehicles = " << vehicles.size() << std::endl; | ||
if(humans.size() != 0){ | ||
|
||
if(vehicles.size() != 0){ | ||
|
||
// check whether there are human objects which overlap with vehicle objects | ||
std::list <Element>::const_iterator humans_iterator; | ||
|
||
for(humans_iterator = humans.begin(); humans_iterator != humans.end(); ++humans_iterator){ | ||
|
||
Element current_human = *humans_iterator; | ||
|
||
std::list <Element>::const_iterator vehicles_iterator; | ||
|
||
for(vehicles_iterator = vehicles.begin(); vehicles_iterator != vehicles.end(); ++vehicles_iterator){ | ||
|
||
bool overlapping = Overlap(current_human, *vehicles_iterator); | ||
// std::cout << "Humans in front of bus OVERLAPPING: " << overlapping << std::endl; | ||
if(overlapping){ | ||
|
||
return true; | ||
|
||
} | ||
|
||
} | ||
} | ||
|
||
} | ||
|
||
return false; | ||
} | ||
|
||
return false; | ||
} | ||
|
Oops, something went wrong.