Skip to content

Commit

Permalink
moving file around
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhengren committed Jul 8, 2015
1 parent 674a436 commit 6e6b6cc
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 40 deletions.
46 changes: 20 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
cmake_minimum_required(VERSION 2.8)
project(gSLIC2)


#SET (CMAKE_VERBOSE_MAKEFILE true)

find_package(CUDA REQUIRED)
find_package(OpenCV REQUIRED)


IF(MSVC_IDE)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-DUSING_CMAKE=1)
Expand All @@ -18,38 +22,28 @@ endif(APPLE)

include_directories(${CUDA_INCLUDE_DIRS})
include_directories(${OpenCV_INCLUDE_DIRS})

add_subdirectory(ORUtils)

set(GSLIC_ENGINES
engines/gSLIC_core_engine.h
engines/gSLIC_seg_engine.h
engines/gSLIC_seg_engine_GPU.h
engines/gSLIC_seg_engine_shared.h
engines/gSLIC_core_engine.cpp
engines/gSLIC_seg_engine.cpp
engines/gSLIC_seg_engine_GPU.cu
)

set(GSLIC_OBJECTS
objects/gSLIC_settings.h
objects/gSLIC_spixel_info.h
)

set(GSLIC_UTILS
gSLIC_defines.h
NVTimer.h
set(GSLIC_LIB
gSLIC_Lib/engines/gSLIC_core_engine.h
gSLIC_Lib/engines/gSLIC_seg_engine.h
gSLIC_Lib/engines/gSLIC_seg_engine_GPU.h
gSLIC_Lib/engines/gSLIC_seg_engine_shared.h
gSLIC_Lib/engines/gSLIC_core_engine.cpp
gSLIC_Lib/engines/gSLIC_seg_engine.cpp
gSLIC_Lib/engines/gSLIC_seg_engine_GPU.cu
gSLIC_Lib/objects/gSLIC_settings.h
gSLIC_Lib/objects/gSLIC_spixel_info.h
gSLIC_Lib/gSLIC_defines.h
gSLIC_Lib/gSLIC.h
)

SOURCE_GROUP(engines FILES ${GSLIC_ENGINES})
SOURCE_GROUP(objects FILES ${GSLIC_OBJECTS})
SOURCE_GROUP(utils FILES ${GSLIC_UTILS})
list(APPEND "-std=c++11 -ftree-vectorize")
SOURCE_GROUP(engines FILES ${GSLIC_LIB})

cuda_add_library(gSLIC2_lib
${GSLIC_ENGINES}
${GSLIC_OBJECTS}
${ORUTILS_HEADERS}
${GSLIC_UTILS}
${GSLIC_LIB}
NVTimer.h
OPTIONS -gencode arch=compute_30,code=compute_30)
target_link_libraries(gSLIC2_lib ${CUDA_LIBRARY})

Expand Down
13 changes: 11 additions & 2 deletions demo.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#include <time.h>
#include <stdio.h>

#include "engines/gSLIC_core_engine.h"
#include "gSLIC_Lib/gSLIC.h"
#include "NVTimer.h"

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/opencv.hpp"



using namespace std;
using namespace cv;

Expand Down Expand Up @@ -73,14 +76,20 @@ int main()
Mat oldFrame, frame;
Mat boundry_draw_frame; boundry_draw_frame.create(s, CV_8UC3);

StopWatchInterface *my_timer; sdkCreateTimer(&my_timer);

int key; int save_count = 0;
while (cap.read(oldFrame))
{
resize(oldFrame, frame, s);

load_image(frame, in_img);


sdkResetTimer(&my_timer); sdkStartTimer(&my_timer);
gSLIC_engine->Process_Frame(in_img);
sdkStopTimer(&my_timer);
cout<<"\rsegmentation in:["<<sdkGetTimerValue(&my_timer)<<"]ms"<<flush;

gSLIC_engine->Draw_Segmentation_Result(out_img);

load_image(out_img, boundry_draw_frame);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@ using namespace std;
gSLIC::engines::core_engine::core_engine(const objects::settings& in_settings)
{
slic_seg_engine = new seg_engine_GPU(in_settings);
sdkCreateTimer(&slic_timer);
}

gSLIC::engines::core_engine::~core_engine()
{
delete slic_seg_engine;
delete slic_timer;
}

void gSLIC::engines::core_engine::Process_Frame(UChar4Image* in_img)
{
sdkResetTimer(&slic_timer); sdkStartTimer(&slic_timer);
slic_seg_engine->Perform_Segmentation(in_img);
sdkStopTimer(&slic_timer); printf("\rSegmentation in:[%.2f]ms ", sdkGetTimerValue(&slic_timer));
}

const IntImage * gSLIC::engines::core_engine::Get_Seg_Res()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include "gSLIC_seg_engine_GPU.h"
#include "../NVTimer.h"


namespace gSLIC
{
Expand All @@ -11,7 +11,6 @@ namespace gSLIC
private:

seg_engine* slic_seg_engine;
StopWatchInterface *slic_timer;

public:

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions gSLIC_Lib/gSLIC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "engines/gSLIC_core_engine.h"
14 changes: 8 additions & 6 deletions gSLIC_defines.h → gSLIC_Lib/gSLIC_defines.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#pragma once

#include "ORUtils/PlatformIndependence.h"
#include "ORUtils/Vector.h"
#include "ORUtils/Matrix.h"
#include "ORUtils/Image.h"
#include "ORUtils/MathUtils.h"
#include "ORUtils/MemoryBlock.h"
#include "../ORUtils/PlatformIndependence.h"
#include "../ORUtils/Vector.h"
#include "../ORUtils/Matrix.h"
#include "../ORUtils/Image.h"
#include "../ORUtils/MathUtils.h"
#include "../ORUtils/MemoryBlock.h"

//------------------------------------------------------
//
// Compile time GPU Settings, don't touch it!
//
//------------------------------------------------------

#ifndef BLOCK_DIM
#define BLOCK_DIM 16
#endif

namespace gSLIC
{
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 6e6b6cc

Please sign in to comment.