Skip to content

Commit

Permalink
additional experimental support for raspberry pi camera
Browse files Browse the repository at this point in the history
  • Loading branch information
billtyler committed Feb 8, 2016
1 parent 6de8614 commit ad19fbb
Show file tree
Hide file tree
Showing 305 changed files with 58,254 additions and 0 deletions.
Binary file added external_src/raspicam-0.1.3-1.zip
Binary file not shown.
Binary file added external_src/raspicam-0.1.3.zip
Binary file not shown.
250 changes: 250 additions & 0 deletions external_src/raspicam-0.1.3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
# ----------------------------------------------------------------------------
# Basic Configuration
# ----------------------------------------------------------------------------
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(raspicam)
set(PROJECT_VERSION "0.1.2")
string(REGEX MATCHALL "[0-9]" PROJECT_VERSION_PARTS "${PROJECT_VERSION}")
list(GET PROJECT_VERSION_PARTS 0 PROJECT_VERSION_MAJOR)
list(GET PROJECT_VERSION_PARTS 1 PROJECT_VERSION_MINOR)
list(GET PROJECT_VERSION_PARTS 2 PROJECT_VERSION_PATCH)
set(PROJECT_SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")

#------------------------------------------------------
# Build type
#------------------------------------------------------

IF(NOT CMAKE_BUILD_TYPE )
SET( CMAKE_BUILD_TYPE "Release" )
ENDIF()

#------------------------------------------------------
# Lib Names and Dirs
#------------------------------------------------------

# Postfix of so's:
set(PROJECT_DLLVERSION)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_INSTALL_PREFIX}/lib/cmake/ /usr/lib/cmake)

OPTION(BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON)
OPTION(BUILD_UTILS "Acitvates/Deactivates building utils libraries" ON)

# ----------------------------------------------------------------------------
# Find Dependencies
# ----------------------------------------------------------------------------
#Add include to dependencies dir
include_directories(${PROJECT_SOURCE_DIR}/dependencies ${PROJECT_SOURCE_DIR}/dependencies/mmal ${PROJECT_SOURCE_DIR}/dependencies/vcos)
#find the mmal libraries(I use conditional because I normally comile in pc)

if(${CMAKE_SYSTEM_PROCESSOR} MATCHES arm*)
FIND_LIBRARY(mmalcore_LIBS NAMES mmal_core PATHS /opt/vc/lib)
FIND_LIBRARY(mmalutil_LIBS NAMES mmal_util PATHS /opt/vc/lib)
FIND_LIBRARY(mmal_LIBS NAMES mmal PATHS /opt/vc/lib)
IF( (NOT mmal_LIBS ) OR (NOT mmalutil_LIBS) OR (NOT mmalcore_LIBS) )
MESSAGE(FATAL_ERROR "Could not find mmal libraries")
ENDIF()
set(REQUIRED_LIBRARIES ${REQUIRED_LIBRARIES} ${mmalcore_LIBS} ${mmalutil_LIBS} ${mmal_LIBS} )
ENDIF()

#If opencv installed, creates the libraspicam_cv library module
FIND_PACKAGE(OpenCV)
IF(OpenCV_FOUND)
include_directories(${OpenCV_INCLUDE_DIRS})
SET(LIB_COMPONENTS ${LIB_COMPONENTS} ${PROJECT_NAME}_cv)
SET(PROJECT_CV_CREATED_FLAG "YES")
ENDIF()



# ----------------------------------------------------------------------------
# PROJECT CONFIGURATION
# force some variables that could be defined in the command line to be written to cache
# ----------------------------------------------------------------------------
OPTION(INSTALL_DOC "Set to ON to build/install Documentation" OFF)
IF (INSTALL_DOC)
FIND_PACKAGE(Doxygen REQUIRED)
MESSAGE( STATUS "INSTALL_DOC: ${INSTALL_DOC} ")
INCLUDE("${PROJECT_SOURCE_DIR}/generateDoc.cmake")
GENERATE_DOCUMENTATION(${PROJECT_SOURCE_DIR}/dox.in)
ENDIF()


# ----------------------------------------------------------------------------
# Uninstall target, for "make uninstall"
# ----------------------------------------------------------------------------
CONFIGURE_FILE( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")

# ----------------------------------------------------------------------------
# create configuration file from .in file (If you use windows take care with paths)
# ----------------------------------------------------------------------------
CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/config.cmake.in" "${PROJECT_BINARY_DIR}/Find${PROJECT_NAME}.cmake")
CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/config.cmake.in" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake")
INSTALL(FILES "${PROJECT_BINARY_DIR}/Find${PROJECT_NAME}.cmake" DESTINATION lib/cmake/ )
INSTALL(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" DESTINATION lib/cmake/ )

# ----------------------------------------------------------------------------
# Program Optimization and debug (Extracted from OpenCV)
# ----------------------------------------------------------------------------
set(WARNINGS_ARE_ERRORS OFF CACHE BOOL "Treat warnings as errors")
set(WHOLE_PROGRAM_OPTIMIZATION OFF CACHE BOOL "Flags for whole program optimization.")
set(EXTRA_C_FLAGS "")
set(EXTRA_C_FLAGS_RELEASE "")
set(EXTRA_C_FLAGS_DEBUG "")
set(EXTRA_EXE_LINKER_FLAGS "")
set(EXTRA_EXE_LINKER_FLAGS_RELEASE "")
set(EXTRA_EXE_LINKER_FLAGS_DEBUG "")

IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
set(ENABLE_PROFILING OFF CACHE BOOL "Enable profiling in the GCC compiler (Add flags: -g -pg)")
set(USE_OMIT_FRAME_POINTER ON CACHE BOOL "Enable -fomit-frame-pointer for GCC")
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES arm*) # We can use only -O2 because the -O3 causes gcc crash
set(USE_O2 ON CACHE BOOL "Enable -O2 for GCC")
set(USE_FAST_MATH ON CACHE BOOL "Enable -ffast-math for GCC")
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES powerpc*)
set(USE_O3 ON CACHE BOOL "Enable -O3 for GCC")
set(USE_POWERPC ON CACHE BOOL "Enable PowerPC for GCC")
endif ()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64* OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64*)
set(USE_O3 ON CACHE BOOL "Enable -O3 for GCC")
set(USE_FAST_MATH ON CACHE BOOL "Enable -ffast-math for GCC")
set(USE_MMX ON CACHE BOOL "Enable MMX for GCC")
set(USE_SSE ON CACHE BOOL "Enable SSE for GCC")
set(USE_SSE2 ON CACHE BOOL "Enable SSE2 for GCC")
set(USE_SSE3 ON CACHE BOOL "Enable SSE3 for GCC")
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES i686* OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES x86)
set(USE_O3 ON CACHE BOOL "Enable -O3 for GCC")
set(USE_FAST_MATH ON CACHE BOOL "Enable -ffast-math for GCC")
set(USE_MMX ON CACHE BOOL "Enable MMX for GCC")
set(USE_SSE OFF CACHE BOOL "Enable SSE for GCC")
set(USE_SSE2 OFF CACHE BOOL "Enable SSE2 for GCC")
set(USE_SSE3 OFF CACHE BOOL "Enable SSE3 for GCC")
endif ()

set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wall")

if(WARNINGS_ARE_ERRORS)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror")
endif()

# The -Wno-long-long is required in 64bit systems when including sytem headers.
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64* OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long")
endif()

# Whole program optimization
if(WHOLE_PROGRAM_OPTIMIZATION)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fwhole-program --combine")
endif()

# Other optimizations
if(USE_OMIT_FRAME_POINTER)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fomit-frame-pointer")
endif()
if(USE_O2)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O2")
endif()
if(USE_O3)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O3")
endif()
if(USE_FAST_MATH)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -ffast-math")
endif()
if(USE_POWERPC)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mcpu=G3 -mtune=G5")
endif()
if(USE_MMX)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mmmx")
endif()
if(USE_SSE)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse")
endif()
if(USE_SSE2)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse2")
endif()
if(USE_SSE3 AND NOT MINGW) # SSE3 should be disabled under MingW because it generates compiler errors
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse3")
endif()

if(ENABLE_PROFILING)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -pg -g")
else()
if(NOT APPLE)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -ffunction-sections")
endif()
endif()

# Parallel mode
if(ENABLE_OPENMP)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -fopenmp")
set(LINKER_LIBS ${LINKER_LIBS} gomp)
endif()

set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -DNDEBUG")
set(EXTRA_C_FLAGS_DEBUG "-g3 -O0 -DDEBUG -D_DEBUG -W -Wextra -Wno-return-type")

MESSAGE( STATUS "-------------------------------------------------------------------------------" )
message( STATUS "GNU COMPILER")
MESSAGE( STATUS "-------------------------------------------------------------------------------" )

ENDIF ()

IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES armv6l ) ##BEAGLE BOARD
SET(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -ftree-vectorize")
ENDIF()

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wl,--no-as-needed")#for using condition variables
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_C_FLAGS} ")
SET(CMAKE_CXX_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -lpthread")
SET(CMAKE_CXX_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} -lpthread")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EXTRA_EXE_LINKER_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${EXTRA_EXE_LINKER_FLAGS_RELEASE}")
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${EXTRA_EXE_LINKER_FLAGS_DEBUG}")




#------------------------------------------------
# DIRS
#------------------------------------------------
ADD_SUBDIRECTORY(src)
IF(BUILD_UTILS)
ADD_SUBDIRECTORY(utils)
ENDIF()


# ----------------------------------------------------------------------------
# display status message for important variables
# ----------------------------------------------------------------------------
message( STATUS )
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
message( STATUS "General configuration for ${PROJECT_NAME} ${PROJECT_VERSION}")
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
message( STATUS )
message(" Built as dynamic libs?:" ${BUILD_SHARED_LIBS})
message(" Compiler:" "${CMAKE_COMPILER}" "${CMAKE_CXX_COMPILER}")
message( STATUS "C++ flags (Release): ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
message( STATUS "C++ flags (Debug): ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
message( STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message( STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")

MESSAGE( STATUS )
MESSAGE( STATUS "CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}" )
MESSAGE( STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}" )
MESSAGE( STATUS "BUILD_UTILS = ${BUILD_UTILS}" )

MESSAGE( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" )
MESSAGE( STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" )
MESSAGE( STATUS "CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}" )

MESSAGE( STATUS )
MESSAGE( STATUS "CREATE OPENCV MODULE=${OpenCV_FOUND}")
MESSAGE( STATUS "CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
MESSAGE( STATUS "REQUIRED_LIBRARIES=${REQUIRED_LIBRARIES}")
MESSAGE( STATUS )
MESSAGE( STATUS )
MESSAGE( STATUS "Change a value with: cmake -D<Variable>=<Value>" )
MESSAGE( STATUS )
33 changes: 33 additions & 0 deletions external_src/raspicam-0.1.3/Changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
0.1.3
- Native support for BGR and RGB in opencv classes. No need to do conversion anymore.
0.1.2
- Solved deadlock error in grab
0.1.1
- Moved to c++11 mutex and condition_variables. Bug fixed that caused random dead lock condition in grab()
0.1.0
- Bug fixed in release for RapiCam and RaspiCam_Cv
0.0.7
- Added classes RaspiCam_Still and RaspiCam_Still_Cv for still camera mode
0.0.6
- Bug ins cv camera corrected
0.0.5
- getImageBuffeSize change by getImageBufferSize (sorry)
- Change in capture format. Now, it is able to capture in RGB at high speed.
- The second parameter of retrieve is now useless. Format must be specified in Raspicam::(set/get)Format before opening the camera and can not be change during operation.
- RaspiCam_Cv captures in BGR, which is obtained by converting from RGB. Therefore, performance drops to half repect to the RaspiCam in RGB mode when using 1280x960.
0.0.4
- Added shutter speed camera control
- OpenCv set/get params are now scaled to [0,100]
- Added more command line options in test programs
0.0.3
- Fixed error in color conversion (rgb and bgr were swapped)
- Added command line options in raspicam_test to adjust exposure
- Changes in RaspiCam_Cv so that exposure can be adjusted. Very simply.
0.0.2
- Decoupled opening from the start of capture in RaspiCam if desired. RapiCam::open and RaspiCam::startCapture
- Added function RaspiCam::getId and RaspiCam_Cv::getId
- Added a new way to convert yuv2rgb which is a bit faster.Thanks to Stefan Gufman (gruffypuffy at gmail dot com)
- Added command line option -test_speed to utils programs (do not save images to memory)
- Removed useless code in private_impl
0.0.1
Initial libary
Loading

0 comments on commit ad19fbb

Please sign in to comment.