Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
first commit of library
  • Loading branch information
kevin committed Feb 16, 2012
0 parents commit 8861128
Show file tree
Hide file tree
Showing 25 changed files with 14,503 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
build
bin
64 changes: 64 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
cmake_minimum_required(VERSION 2.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type. Options are:
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage
# Debug : w/ debug symbols, w/o optimization
# Release : w/o debug symbols, w/ optimization
# RelWithDebInfo : w/ debug symbols, w/ optimization
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
set(ROS_BUILD_TYPE Release)

rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#uncomment if you have defined messages
#rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()

#common commands for building c++ executables and libraries
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_add_boost_directories()
#rosbuild_link_boost(${PROJECT_NAME} thread)
#rosbuild_add_executable(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})

project (libviso2)

# include directory
include_directories(${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME})

# use sse3 instruction set
SET(CMAKE_CXX_FLAGS "-msse3")

# OpenCV
find_package(OpenCV 2.3.1 REQUIRED)
if(OpenCV_FOUND)
message("======== ${OpenCV_VERSION} Found ========= ")
endif(OpenCV_FOUND)


# sources
FILE(GLOB LIBVISO2_SRC_FILES "src/lib/*.cpp")

# build library
rosbuild_add_library(viso2 ${LIBVISO2_SRC_FILES})

# stereo demo program
rosbuild_add_executable(stereo_demo "src/stereo_demo.cpp")
target_link_libraries(stereo_demo ${OpenCV_LIBS} viso2)

# mono demo program
rosbuild_add_executable(mono_demo "src/mono_demo.cpp")
target_link_libraries(mono_demo ${OpenCV_LIBS} viso2)

# mono node
rosbuild_add_executable(mono_node "src/mono_node.cpp")
target_link_libraries(mono_node ${OpenCV_LIBS} viso2)

1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include $(shell rospack find mk)/cmake.mk
99 changes: 99 additions & 0 deletions include/libviso2/filter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
Copyright 2012. All rights reserved.
Institute of Measurement and Control Systems
Karlsruhe Institute of Technology, Germany
This file is part of libelas.
Authors: Julius Ziegler, Andreas Geiger
libelas is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or any later version.
libelas is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
libelas; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA 02110-1301, USA
*/

#ifndef __FILTER_H__
#define __FILTER_H__

#include <emmintrin.h>
#include <pmmintrin.h>

// define fixed-width datatypes for Visual Studio projects
#ifndef _MSC_VER
#include <stdint.h>
#else
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#endif

// fast filters: implements 3x3 and 5x5 sobel filters and
// 5x5 blob and corner filters based on SSE2/3 instructions
namespace filter {

// private namespace, public user functions at the bottom of this file
namespace detail {
void integral_image( const uint8_t* in, int32_t* out, int w, int h );
void unpack_8bit_to_16bit( const __m128i a, __m128i& b0, __m128i& b1 );
void pack_16bit_to_8bit_saturate( const __m128i a0, const __m128i a1, __m128i& b );

// convolve image with a (1,4,6,4,1) row vector. Result is accumulated into output.
// output is scaled by 1/128, then clamped to [-128,128], and finally shifted to [0,255].
void convolve_14641_row_5x5_16bit( const int16_t* in, uint8_t* out, int w, int h );

// convolve image with a (1,2,0,-2,-1) row vector. Result is accumulated into output.
// This one works on 16bit input and 8bit output.
// output is scaled by 1/128, then clamped to [-128,128], and finally shifted to [0,255].
void convolve_12021_row_5x5_16bit( const int16_t* in, uint8_t* out, int w, int h );

// convolve image with a (1,2,1) row vector. Result is accumulated into output.
// This one works on 16bit input and 8bit output.
// output is scaled by 1/4, then clamped to [-128,128], and finally shifted to [0,255].
void convolve_121_row_3x3_16bit( const int16_t* in, uint8_t* out, int w, int h );

// convolve image with a (1,0,-1) row vector. Result is accumulated into output.
// This one works on 16bit input and 8bit output.
// output is scaled by 1/4, then clamped to [-128,128], and finally shifted to [0,255].
void convolve_101_row_3x3_16bit( const int16_t* in, uint8_t* out, int w, int h );

void convolve_cols_5x5( const unsigned char* in, int16_t* out_v, int16_t* out_h, int w, int h );

void convolve_col_p1p1p0m1m1_5x5( const unsigned char* in, int16_t* out, int w, int h );

void convolve_row_p1p1p0m1m1_5x5( const int16_t* in, int16_t* out, int w, int h );

void convolve_cols_3x3( const unsigned char* in, int16_t* out_v, int16_t* out_h, int w, int h );
}

void sobel3x3( const uint8_t* in, uint8_t* out_v, uint8_t* out_h, int w, int h );

void sobel5x5( const uint8_t* in, uint8_t* out_v, uint8_t* out_h, int w, int h );

// -1 -1 0 1 1
// -1 -1 0 1 1
// 0 0 0 0 0
// 1 1 0 -1 -1
// 1 1 0 -1 -1
void checkerboard5x5( const uint8_t* in, int16_t* out, int w, int h );

// -1 -1 -1 -1 -1
// -1 1 1 1 -1
// -1 1 8 1 -1
// -1 1 1 1 -1
// -1 -1 -1 -1 -1
void blob5x5( const uint8_t* in, int16_t* out, int w, int h );
};

#endif
Loading

0 comments on commit 8861128

Please sign in to comment.