Skip to content

Commit

Permalink
added vision lib
Browse files Browse the repository at this point in the history
  • Loading branch information
dsgou committed May 5, 2016
1 parent 82a3342 commit 16046ef
Show file tree
Hide file tree
Showing 15 changed files with 1,602 additions and 2,937 deletions.
14 changes: 9 additions & 5 deletions chroma/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ project(chroma)

set(CMAKE_CXX_FLAGS "-std=c++11")

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
cv_bridge
image_transport
Expand All @@ -22,15 +19,22 @@ aux_source_directory(src/ SRC_LIST)

include_directories(
include
/usr/include/
${catkin_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
)

add_executable(chroma ${SRC_LIST})

link_directories(/usr/include /usr/lib/x86_64-linux-gnu/)
link_directories(
/usr/lib/
/usr/local/lib/
/usr/lib/x86_64-linux-gnu/
)

add_executable(chroma ${SRC_LIST})

target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES}
${OpenCV_LIBRARIES}
libvision.so
)
13 changes: 8 additions & 5 deletions chroma/CMakeLists.txt~
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ project(chroma)

set(CMAKE_CXX_FLAGS "-std=c++11")

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
cv_bridge
image_transport
Expand All @@ -22,16 +19,22 @@ aux_source_directory(src/ SRC_LIST)

include_directories(
include
/usr/include/
${catkin_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
)


add_executable(chroma ${SRC_LIST})
link_directories(
/usr/lib/
/usr/local/lib/
/usr/lib/x86_64-linux-gnu/
)

link_directories(/usr/include /usr/lib/x86_64-linux-gnu/)
add_executable(chroma ${SRC_LIST})

target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES}
${OpenCV_LIBRARIES}
libvision.so
)
34 changes: 2 additions & 32 deletions chroma/include/chroma.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,49 +21,20 @@
#include <limits>
#include <opencv2/video/background_segm.hpp>
#include <exception>
#include <vision.hpp>

using namespace std;
using namespace cv;

class Chroma_processing
{
public:

struct Position
{
float x = 0.0;
float y = 0.0;
float z = 0.0;
float height = 0.0;
float distance = 0.0;
};

struct People
{
vector< Rect_<int> > tracked_boxes;
vector< float > tracked_rankings;
vector< Position > tracked_pos;
};



Chroma_processing();
~Chroma_processing();

//image and depth callbacks
void imageCb(const sensor_msgs::ImageConstPtr& msg);

//Background & foreground estimation, to be used in sequence
void estimateBackground(Mat& src, Mat& dst, vector<Mat>& storage, int recursion, float ratio = 0.04, int index = 0);
void estimateForeground(Mat& src1, Mat& src2, Mat& dst);

//Detection and tracking of blobs
void detectBlobs(const Mat& src, vector< Rect_<int> >& colour_areas, int range);
void track(vector< Rect_<int> >& current, People& collection, int rank = 3, float threshold = 0.2);

//helper functions
int threshold(Mat& src, Mat& dst, int thresh);
inline void gammaCorrection(Mat& src);
void frameDif(Mat& src1, Mat& src2, Mat& dst, float threshold);


private:
Expand All @@ -86,7 +57,6 @@ class Chroma_processing

vector< Rect_<int> > rgb_rects;


bool playback_topics;
bool display;
bool has_image = false;
Expand Down
Loading

0 comments on commit 16046ef

Please sign in to comment.