Skip to content
This repository was archived by the owner on May 25, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
25b5eba
New PixelObjectList Class. Used to store all pixelobjects in a sequen…
Sep 27, 2016
6b2ce3f
Added haversine formula for calculating GPS coordinates
Oct 24, 2016
030044c
Finished GPS corner function
Oct 26, 2016
94566f0
Possibly finished the GPS coordinate implementation
Oct 27, 2016
c15c80a
Add GPS coordinates to Pixel Objects, uniqueness is observed and anal…
Oct 30, 2016
5725401
Reformatted targetanalysis code to use objectlist rather than pixelob…
Dec 10, 2016
02473c7
Redefined TargetAnalysis code flow
Dec 10, 2016
b0e2c06
Added a compareAndAdd function. For now it uses statistics and a bit …
Dec 10, 2016
2996458
Doesn't need to be a class, because it would be a singleton... Simply…
Dec 12, 2016
0b09a23
Code compiles. Whether it works or not is another question. Next step…
Dec 13, 2016
2d1caa6
Started building uniqueness test for pixel objects
Jan 14, 2017
6a7b80d
Added test images where duplicates are present. Preliminary duplicate…
Feb 21, 2017
dfda04b
Object comparison code works now. Optimizations still need to be comp…
Feb 22, 2017
9cc79aa
Removed unecessary file for testdata specific to targetanalysis. Chan…
Mar 9, 2017
1f504f0
Documented the PixelObjectList Class
Mar 9, 2017
d1ace28
Added final comments and documentation to target_analyzer. Also remov…
Mar 9, 2017
c82d14d
Merge Conflict resolved
Apr 8, 2017
2dbb76e
Beginning integration of GPS analysis. Next step, Unit tests for GPS …
Apr 9, 2017
3a7bbe4
Added ability for contours to be GPS located (based on the centroid).…
Apr 10, 2017
63b6663
Finished GPS integration. Added tests to test functionality.
Apr 12, 2017
9c05359
Colour Comparison Working. The fuzzy logic which groups duplicate obj…
Apr 19, 2017
bc1b157
TargetAnalyzer is the settings singleton. It now contains threshold a…
Apr 19, 2017
3e8bc64
Optimized addition of nodes, fixed issues with private/public members
Apr 22, 2017
33df7f8
compareContour changed to be super efficient. It is an order of magni…
Apr 23, 2017
99271e8
Merged Conflicts
Apr 27, 2017
0fe008e
Fixed to incorporate new constructor for Frame.h
Apr 27, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <fstream>
#include "frame.h"
#include "target_identifier.h"
#include "target_analyzer.h"
#include "imgimport.h"
#include "decklink_import.h"
#include "pictureimport.h"
Expand Down Expand Up @@ -78,6 +79,7 @@ int processors;
ImageImport * importer = NULL;
TargetIdentifier identifier;
MetadataInput * logReader = NULL;
TargetAnalyzer * analyzer = NULL;

double aveFrameTime = 1000;
int frameCount = 0;
Expand All @@ -87,9 +89,16 @@ void worker(Frame* f) {
workers++;
assert(!f->get_img().empty());
identifier.process_frame(f);
if (intermediate && f->get_objects().size() > 0) {
int poSize = f->get_objects().size();
if (intermediate && poSize > 0) {
intermediate_buffer.push(f);
}

//Analyze the image after it is identified
analyzer = TargetAnalyzer::getInstance();
for (int i = 0; i < poSize; i++){
analyzer->analyze_pixelobject(f->get_objects()[i]);
}

workers--;
auto end = std::chrono::steady_clock::now();
Expand Down Expand Up @@ -168,6 +177,7 @@ int main(int argc, char** argv) {

ioService.post(boost::bind(read_images));
ioService.post(boost::bind(assign_workers));
//ioService.post(boost::bind());
ioService.post(boost::bind(output));

boost::asio::io_service::work work(ioService);
Expand Down
34 changes: 30 additions & 4 deletions modules/core/include/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class PixelObject;

class Object {
public:
Object(std::string type);
Object();

/**
* @brief Getter for Object image
Expand Down Expand Up @@ -92,21 +92,47 @@ class Object {
*/
double get_error_angle();

/**
* @brief Getter for the pixel distance
*
* @return The distance covered by each pixel of the image in the X and Y
* directions.
*/
cv::Point2d get_pixel_distance();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Objects wouldn't have a single distance since they are composed of multiple frames. If anything you might want to include this sort of information in a frame.


/**
* @brief Setter for the pixel distance
*
* @param The distance covered by each pixel of the image in the X and Y
* directions.
*/
void set_pixel_distance(cv::Point2d);

/**
* @brief Setter for the pixel distance
*
* @param The distance covered by each pixel of the image in the X direction.
* @param The distance covered by each pixel of the image in the Y
* direction.
*/
void set_pixel_distance(double x, double y);


/**
* @brief Adds given PixelObject to Object's storage
* and recalculate target information
*
* @param o PixelObject to be added
* @param po PixelObject to be added
*/
void add_object(Object * o);
void add_pobject(PixelObject * po);

/**
* @brief Getter for pixel Objects
*
* @return Array containing all of the PixelObjects that were used to
* create this instance of Object
*/
const std::vector<Object *> & get_objects();
const std::vector<PixelObject *> & get_pobjects();
private:

/**
Expand Down
3 changes: 2 additions & 1 deletion modules/core/include/pixel_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @section LICENSE
*
* Copyright (c) 2015, Waterloo Aerial Robotics Group (WARG)
* Copyright (c) 2015-2016, Waterloo Aerial Robotics Group (WARG)
* All rights reserved.
*
* This software is licensed under a modified version of the BSD 3 clause license
Expand Down Expand Up @@ -141,6 +141,7 @@ class PixelObject{
* @brief Cropped picture of object
*/
cv::Mat crop;

};


Expand Down
34 changes: 30 additions & 4 deletions modules/core/include/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @section LICENSE
*
* Copyright (c) 2015, Waterloo Aerial Robotics Group (WARG)
* Copyright (c) 2015-2016, Waterloo Aerial Robotics Group (WARG)
* All rights reserved.
*
* This software is licensed under a modified version of the BSD 3 clause license
Expand Down Expand Up @@ -33,7 +33,7 @@ class Object;

class Target{
public:
Target(std::string type);
Target();

/**
* @brief Getter for Target image
Expand All @@ -54,7 +54,16 @@ class Target{
*
* @return GPS co-ordinates of the Target
*/
cv::Point2f get_centroid();
cv::Point2d get_centroid();

/**
* @brief Getter for the pixel distance
*
* @return The distance covered by each pixel of the image in the X and Y
* directions.
*/
cv::Point2d get_pixel_distance();


/**
* @brief Getter for area
Expand Down Expand Up @@ -106,6 +115,16 @@ class Target{
* create this instance of Target
*/
const std::vector<Object *> & get_objects();

/**
* @brief Setter for the pixel distance.
*
* @param x The distance covered by each pixel of the image in the X.
* @param y The distance covered by each pixel of the image in the Y.
*/
void set_pixel_distance(double x, double y);
void set_pixel_distance(cv::Point2d);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the comment on Object, Target likewise isn't tied to a single frame


private:

/**
Expand All @@ -126,8 +145,15 @@ class Target{
/**
* @brief GPS co-ordinates of the centre of the Target
*/
cv::Point2f centroid;
cv::Point2d centroid;

/**
* @brief Distance covered by each pixel in the original target image
* (non-cropped). Each pixel is measured in terms of meters.
*/
cv::Point2d pixelDistance;


/**
* @brief area of the target in square metres
*/
Expand Down
15 changes: 15 additions & 0 deletions modules/core/src/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,19 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "object.h"
#include "pixel_object.h"

Object::Object(){

}

void Object::add_pobject(PixelObject * po){
pixelObjects.push_back(po);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that there's a bunch of other things that need to be done here. For now just averaging the data from the PixelObjects in the Object should be fine, we can do more later.

}

const std::vector<PixelObject*>& Object::get_pobjects(){
return pixelObjects;
}


44 changes: 14 additions & 30 deletions modules/core/src/target.cpp
Original file line number Diff line number Diff line change
@@ -1,32 +1,16 @@
/*
This file is part of WARG's computer-vision

Copyright (c) 2015, Waterloo Aerial Robotics Group (WARG)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Usage of this code MUST be explicitly referenced to WARG and this code
cannot be used in any competition against WARG.
4. Neither the name of the WARG nor the names of its contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY WARG ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL WARG BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file target.cpp
* @author WARG
*
* @section LICENSE
*
* Copyright (c) 2015-2016, Waterloo Aerial Robotics Group (WARG)
* All rights reserved.
*
* This software is licensed under a modified version of the BSD 3 clause license
* that should have been included with this software in a file called COPYING.txt
* Otherwise it is available at:
* https://raw.githubusercontent.com/UWARG/computer-vision/master/COPYING.txt
*/


6 changes: 3 additions & 3 deletions modules/targetanalysis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include_directories(include ../core/include)
include_directories(include ../core/include ../targetid/include)
ADD_DEFINITIONS("-DBOOST_LOG_DYN_LINK")
add_library(TargetAnalysis src/area_analyzer.cpp src/target_analyzer.cpp src/target_loader.cpp)
target_link_libraries(TargetAnalysis ${Boost_LIBRARIES} Core)
add_library(TargetAnalysis src/area_analyzer.cpp src/target_analyzer.cpp src/target_loader.cpp src/pixel_object_list.cpp)
target_link_libraries(TargetAnalysis ${Boost_LIBRARIES} Core TargetIdentification)
target_compile_features(TargetAnalysis PRIVATE)
add_subdirectory("test")
75 changes: 75 additions & 0 deletions modules/targetanalysis/include/object_list.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
This file is part of WARG's computer-vision

Copyright (c) 2015, Waterloo Aerial Robotics Group (WARG)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Usage of this code MUST be explicitly referenced to WARG and this code
cannot be used in any competition against WARG.
4. Neither the name of the WARG nor the names of its contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY WARG ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL WARG BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef OBJECT_LIST_H_INCLUDED
#define OBJECT_LIST_H_INCLUDED

/**
* @file object_list.h
*
* @brief Class which describes a structure for storing pixel targets and then
* later finding a matching set of targets.
*
* Module geolocates targets using their pixel locations
* and photo metadata, determines target type and calculates
* possible error. As targets are processed unique targets will
* be identified and the data combined into a single object.
*
*
**/

#include "frame.h"
#include "object.h"

struct oNode{
Object* o;
struct oNode* next;

};

class ObjectList
{
private:
oNode* head;
oNode* tail;
int listLength;
public:
//Constructor
ObjectList();
//Destructor
~ObjectList();

bool addNode(Object* o);
bool getGPSDuplicates();
bool getVisualDuplicates();
};

#endif // OBJECT_LIST_H_INCLUDED
Loading