Skip to content

Commit

Permalink
FIX: boost, opencv and json-cpp build dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
asmagina committed Nov 27, 2018
1 parent 7afa11d commit 17dbd92
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 39 deletions.
58 changes: 47 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Copyright (c) 2017, Visillect Service LLC. All rights reserved.
##

cmake_minimum_required(VERSION 3.0.0)
cmake_minimum_required(VERSION 3.5.1)

set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo" CACHE STRING "possible build types" FORCE)

Expand Down Expand Up @@ -37,13 +37,46 @@ include(cmake/options.cmake)
include(cmake/arch.cmake)
include(cmake/func_macro.cmake)

# boost setup
if(WIN32)
set(Boost_USE_STATIC_LIBS ON)
else()
set(Boost_USE_STATIC_LIBS OFF)
endif()

find_package(Boost REQUIRED COMPONENTS system filesystem)
set(SEGM_BOOST_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}")
if(SEGM_BOOST_VERSION VERSION_LESS "1.54")
message(FATAL_ERROR "Bad boost version.")
endif()
include_directories(${Boost_INCLUDE_DIRS})

find_package(OpenCV REQUIRED)
if (OpenCV_VERSION_MAJOR EQUAL "3")
add_definitions("-DOPENCV3=1")
else()
message(FATAL_ERROR "Bad OpenCV version.")
endif()
include_directories(${OpenCV_INCLUDE_DIRS})

set(MINSUBSYSTEM_ENABLE_MINBASE ON CACHE BOOL "enable minbase")
set(MINSUBSYSTEM_ENABLE_MINGEO OFF CACHE BOOL "enable mingeo")
set(MINSUBSYSTEM_ENABLE_MINUTILS ON CACHE BOOL "enable minutils")
set(MINSUBSYSTEM_ENABLE_MINIMGAPI ON CACHE BOOL "enable minimgapi")
set(MINSUBSYSTEM_ENABLE_MINIMGPRC ON CACHE BOOL "enable minimgprc")
set(MINSUBSYSTEM_ENABLE_MINIMGIO ON CACHE BOOL "enable minimgio")
set(MINSUBSYSTEM_ENABLE_MINSTOPWATCH ON CACHE BOOL "enable minstopwatch")

# global include directories
include_directories(vi_packages)
# include_directories(se_packages)
include_directories(minsubsystem)
include_directories(thirdparty/zlib/src)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/thirdparty/libtiff)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/thirdparty/libpng)
include_directories(thirdparty)
# include_directories(tools)
# include_directories(sandbox)

include_directories(minsubsystem)
include_directories(vi_packages)

# Sort of ad-hoc include paths.

# output directories
set(SEGM_BINARY_PATH ${CMAKE_BINARY_DIR}/segmentation)
Expand All @@ -59,9 +92,12 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${SEGM_BINARY_PATH}/lib.${SEGM

###################################################################

add_subdirectory(vi_packages)
# add_subdirectory(se_packages)
add_subdirectory(minsubsystem)
add_subdirectory(thirdparty)
# add_subdirectory(sandbox)
# add_subdirectory(tools)
add_subdirectory(minsubsystem)
add_subdirectory(vi_packages)

option(BUILD_SANDBOX "Build sandbox projects" OFF)
if (BUILD_SANDBOX)
include_directories(sandbox)
add_subdirectory(sandbox)
endif()
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,35 @@

Here we publish a set of image segmentation libraries developed for the research in a [Vision System Laboratory at IITP RAS](http://iitp.ru/en/researchlabs/281.htm). Currently this not very big collection includes the following:

* [remseg](https://github.com/Visillect/segmentation/tree/master/vi_packages/remseg) — region adgacency graph (RAG) framework
* [remseg](https://github.com/Visillect/segmentation/tree/master/vi_packages/remseg) — region adgacency graph (RAG) framework
* [colorseg](https://github.com/Visillect/segmentation/tree/master/vi_packages/colorseg) — color-based segmentation

## Getting started

### Installation

Practically, the code is not platform specific but it is tested only on Linux.
The official support is curently provided only for Linux too.

First, install `libjsocpp-dev` package, for example, in Ubuntu run

sudo apt install libjsoncpp-dev
The official support is curently provided only for Linux too.

To configure and compile the project run the following command:

git clone https://github.com/Visillect/segmentation
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
make

### Image data stucture manipulations

For manipalutions with images the `MinImg` data structure is used provided in
[minsubsystem](https://github.com/Visillect/segmentation/tree/master/minsubsystem) libraries.
For manipalutions with images the `MinImg` data structure is used provided in
[minsubsystem](https://github.com/Visillect/segmentation/tree/master/minsubsystem) libraries.

For compatility with [OpenCV](https://www.opencv.org/) image types the [vi_cvt](https://github.com/Visillect/segmentation/tree/master/vi_packages/vi_cvt) package is provided.

The convertion from OpenCV `cv::Mat` to `MinImg` could be done as

#include <vi_oct/ocv.h>

cv::Mat cv_image = ...
...
MinImg min_image = vi::cvt::ocv::as_minimg(cv_image);
Expand All @@ -44,9 +40,9 @@ To convert `MinImg` to `cv::Mat` use
MinImage* min_image = ...
...
cv::Mat cv_image = vi::cvt::ocv::as_cv_mat(min_image);

Also, for `MinImg` smart pointers wrappers are provided in [mximg](https://github.com/Visillect/segmentation/tree/master/vi_packages/mximg) package.

## Support

Please, use the GitHub issue tracker at https://github.com/Visillect/segmentation for bug reports, feature requests, etc.
Expand Down
22 changes: 15 additions & 7 deletions thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@

if(NOT jsoncpp_FOUND)
add_subdirectory(json-cpp)
if (BUILD_SHARED_LIBS)
set(JSONCPP_REAL_LIB_NAME jsoncpp_lib)
else()
set(JSONCPP_REAL_LIB_NAME jsoncpp_lib_static)
endif()
else()
message(STATUS "json-cpp already found, will not build")
endif()
add_subdirectory(jsoncpp_compat)

option(WITH_TIFF "Turns on support for TIFF image format." ON)

include_directories(
${CMAKE_CURRENT_BINARY_DIR}/zlib
${CMAKE_CURRENT_BINARY_DIR}/libtiff
Expand Down Expand Up @@ -28,13 +43,6 @@ set(PNG_LIBRARIES png)
set(PNG_LIBRARY png)
set(PNG_FOUND TRUE)

if(NOT jsoncpp_FOUND)
add_subdirectory(json-cpp)
else()
message(STATUS "json-cpp already found, will not build")
endif()
add_subdirectory(jsoncpp_compat)

if (WITH_TESTS)
add_subdirectory(gtest)
endif (WITH_TESTS)
16 changes: 8 additions & 8 deletions vi_packages/colorseg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ cmake_minimum_required(VERSION 3.0.0)

project(colorseg)

find_package(OpenCV REQUIRED)
find_package(Boost REQUIRED COMPONENTS system filesystem)

add_library(colorseg
src/color_distance_func.cpp
src/color_vertex.cpp
Expand All @@ -25,8 +22,11 @@ target_link_libraries(colorseg
)

#----------------demo---------------------------------------
add_executable(colorseg_go demo/colorseg_go.cpp)
target_link_libraries(colorseg_go
${Boost_LIBRARIES}
${OpenCV_LIBS}
colorseg)

if (Boost_FOUND AND OpenCV_FOUND)
add_executable(colorseg_go demo/colorseg_go.cpp)
target_link_libraries(colorseg_go
${Boost_LIBRARIES}
${OpenCV_LIBS}
colorseg)
endif()

0 comments on commit 17dbd92

Please sign in to comment.