Skip to content

Commit

Permalink
rename to gSLICr
Browse files Browse the repository at this point in the history
  • Loading branch information
victorprad committed Aug 13, 2015
1 parent 7b694e2 commit 754c9d6
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 919 deletions.
34 changes: 17 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,28 @@ include_directories(${CUDA_INCLUDE_DIRS})
include_directories(${OpenCV_INCLUDE_DIRS})
add_subdirectory(ORUtils)

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
set(GSLICR_LIB
gSLICr_Lib/engines/gSLICr_core_engine.h
gSLICr_Lib/engines/gSLICr_seg_engine.h
gSLICr_Lib/engines/gSLICr_seg_engine_GPU.h
gSLICr_Lib/engines/gSLICr_seg_engine_shared.h
gSLICr_Lib/engines/gSLICr_core_engine.cpp
gSLICr_Lib/engines/gSLICr_seg_engine.cpp
gSLICr_Lib/engines/gSLICr_seg_engine_GPU.cu
gSLICr_Lib/objects/gSLICr_settings.h
gSLICr_Lib/objects/gSLICr_spixel_info.h
gSLICr_Lib/gSLICr_defines.h
gSLICr_Lib/gSLICr.h
)

list(APPEND "-std=c++11 -ftree-vectorize")
SOURCE_GROUP(engines FILES ${GSLIC_LIB})
SOURCE_GROUP(engines FILES ${GSLICR_LIB})

cuda_add_library(gSLIC2_lib
${GSLIC_LIB}
cuda_add_library(gSLICr_lib
${GSLICR_LIB}
NVTimer.h
OPTIONS -gencode arch=compute_30,code=compute_30)
target_link_libraries(gSLIC2_lib ${CUDA_LIBRARY})
target_link_libraries(gSLICr_lib ${CUDA_LIBRARY})

add_executable(demo demo.cpp)
target_link_libraries(demo gSLIC2_lib ${OpenCV_LIBS})
target_link_libraries(demo gSLICr_lib ${OpenCV_LIBS})
32 changes: 16 additions & 16 deletions demo.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <time.h>
#include <stdio.h>

#include "gSLIC_Lib/gSLIC.h"
#include "gSLICr_Lib/gSLICr.h"
#include "NVTimer.h"

#include "opencv2/highgui/highgui.hpp"
Expand All @@ -13,9 +13,9 @@
using namespace std;
using namespace cv;

void load_image(const Mat& inimg, gSLIC::UChar4Image* outimg)
void load_image(const Mat& inimg, gSLICr::UChar4Image* outimg)
{
gSLIC::Vector4u* outimg_ptr = outimg->GetData(MEMORYDEVICE_CPU);
gSLICr::Vector4u* outimg_ptr = outimg->GetData(MEMORYDEVICE_CPU);

for (int y = 0; y < outimg->noDims.y;y++)
for (int x = 0; x < outimg->noDims.x; x++)
Expand All @@ -27,9 +27,9 @@ void load_image(const Mat& inimg, gSLIC::UChar4Image* outimg)
}
}

void load_image(const gSLIC::UChar4Image* inimg, Mat& outimg)
void load_image(const gSLICr::UChar4Image* inimg, Mat& outimg)
{
const gSLIC::Vector4u* inimg_ptr = inimg->GetData(MEMORYDEVICE_CPU);
const gSLICr::Vector4u* inimg_ptr = inimg->GetData(MEMORYDEVICE_CPU);

for (int y = 0; y < inimg->noDims.y; y++)
for (int x = 0; x < inimg->noDims.x; x++)
Expand All @@ -53,24 +53,24 @@ int main()
}


// gSLIC settings
gSLIC::objects::settings my_settings;
// gSLICr settings
gSLICr::objects::settings my_settings;
my_settings.img_size.x = 640;
my_settings.img_size.y = 480;
my_settings.no_segs = 2000;
my_settings.spixel_size = 16;
my_settings.coh_weight = 0.6f;
my_settings.no_iters = 5;
my_settings.color_space = gSLIC::XYZ; // gSLIC::CIELAB for Lab, or gSLIC::RGB for RGB
my_settings.seg_method = gSLIC::GIVEN_SIZE; // or gSLIC::GIVEN_NUM for given number
my_settings.color_space = gSLICr::XYZ; // gSLICr::CIELAB for Lab, or gSLICr::RGB for RGB
my_settings.seg_method = gSLICr::GIVEN_SIZE; // or gSLICr::GIVEN_NUM for given number
my_settings.do_enforce_connectivity = true; // wheter or not run the enforce connectivity step

// instantiate a core_engine
gSLIC::engines::core_engine* gSLIC_engine = new gSLIC::engines::core_engine(my_settings);
gSLICr::engines::core_engine* gSLICr_engine = new gSLICr::engines::core_engine(my_settings);

// gSLIC takes gSLIC::UChar4Image as input and out put
gSLIC::UChar4Image* in_img = new gSLIC::UChar4Image(my_settings.img_size, true, true);
gSLIC::UChar4Image* out_img = new gSLIC::UChar4Image(my_settings.img_size, true, true);
// gSLICr takes gSLICr::UChar4Image as input and out put
gSLICr::UChar4Image* in_img = new gSLICr::UChar4Image(my_settings.img_size, true, true);
gSLICr::UChar4Image* out_img = new gSLICr::UChar4Image(my_settings.img_size, true, true);

Size s(my_settings.img_size.x, my_settings.img_size.y);
Mat oldFrame, frame;
Expand All @@ -86,11 +86,11 @@ int main()
load_image(frame, in_img);

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

gSLIC_engine->Draw_Segmentation_Result(out_img);
gSLICr_engine->Draw_Segmentation_Result(out_img);

load_image(out_img, boundry_draw_frame);
imshow("segmentation", boundry_draw_frame);
Expand All @@ -101,7 +101,7 @@ int main()
{
char out_name[100];
sprintf(out_name, "seg_%04i.pgm", save_count);
gSLIC_engine->Write_Seg_Res_To_PGM(out_name);
gSLICr_engine->Write_Seg_Res_To_PGM(out_name);
sprintf(out_name, "edge_%04i.png", save_count);
imwrite(out_name, boundry_draw_frame);
sprintf(out_name, "img_%04i.png", save_count);
Expand Down
50 changes: 0 additions & 50 deletions gSLIC_Lib/engines/gSLIC_core_engine.cpp

This file was deleted.

34 changes: 0 additions & 34 deletions gSLIC_Lib/engines/gSLIC_core_engine.h

This file was deleted.

43 changes: 0 additions & 43 deletions gSLIC_Lib/engines/gSLIC_seg_engine.cpp

This file was deleted.

50 changes: 0 additions & 50 deletions gSLIC_Lib/engines/gSLIC_seg_engine.h

This file was deleted.

Loading

0 comments on commit 754c9d6

Please sign in to comment.