This is an extension from jasonbunk's repo of MingMing Cheng's "DenseCut".
-
Open terminal and Go into CmLib foler
cd CmCode/CmLib
-
Add Makefile
PROJECT := cmcode
CXX_SRC := $(shell find . -name "*.cpp" ! -wholename "examples/.cpp")
OBJ_FILES := ${CXX_SRC:%.cpp=%.o}
DYNAMIC_LIB := lib$(PROJECT).so
STATIC_LIB := lib$(PROJECT).a
INCLUDE_DIRS := .
LIBRARY_DIRS :=
LIBRARIES := COMMON_FLAGS := -Wall -O2 -std=c++11 -fopenmp
CXX_FLAGS :=$(foreach include,$ (INCLUDE_DIRS),-I$(include))
LD_FLAGS :=$(foreach lib,$ (LIBRARY_DIRS),-L$(lib))
LD_FLAGS :=$(foreach lib,$ (LIBRARIES),-l$(lib))
all:obj lib
lib:$(DYNAMIC_LIB) $(STATIC_LIB)
obj:$(OBJ_FILES)
%.o:%.cpp
g++ -fPIC -c -o$@ $ <$(COMMON_FLAGS) $ (CXX_FLAGS)
$(DYNAMIC_LIB):$ (OBJ_FILES)
g++ -shared -o$@ $ (OBJ_FILES)
$(STATIC_LIB):$ (OBJ_FILES)
ar rcs$@ $ (OBJ_FILES) -
Compile it and you will get 'libcmcode.a' and 'libcmcode.so'. Done.
make
-
Open terminal and Go into 'mmcheng_densecut' folder
cd mmcheng_densecut
-
Compile it and you will get 'densecut'. Done.
g++ *.cpp -O2 -Wall -I. -lcmcode -L../CmCode/CmLib -I../ -Wl,-rpath,../CmCode/CmLib -std=c++11 `pkg-config --libs --cflags opencv` -lomp -o densecut
- Some erros occured. For example, "/usr/bin/ld: cannot find -lcufft", just locate libcufft and add the path to $LD_LIBRARY_PATH or $LIBRARY_PATH in the ~/.bashrc.
- Some erros occured. For example, "/usr/bin/ld: cannot find -lcufft", just locate libcufft and add the path to $LD_LIBRARY_PATH or $LIBRARY_PATH in the ~/.bashrc.
-
Run demo in 'mmcheng_densecut' and see the results in 'ASD/Sal4N'.
./densecut ./
-
Done.