Commit 01ad783f authored by Thiago C. Santini's avatar Thiago C. Santini

Initial commit

EyeRec is moving to its own repository for the public release.

The commit history was removed as it may contain sensitive information.

Swirski and Starburst pupil detection algorithms are disabled and not
included as to not contaminate the licensing until we get an answer from
the legal department in this regard.

For internal use:

This is a reorganization of the build structure from:

Repository: SOMA
Branch: migration
Commit: commit ba09d5c3533bf0fd45dd0f94f8aee7f13d70b17d

For the private version containing industry-related features use:

Repository: SOMA
Branch: EyeRec
parents
QT += core gui opengl network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
#DEFINES += STARBURST
#DEFINES += SWIRSKI
TOP = $$PWD
TARGET = EyeRec
SOURCES += \
$${TOP}/src/main.cpp \
$${TOP}/src/ImageProcessing.cpp \
$${TOP}/src/ImageAcquisition.cpp \
$${TOP}/src/NetworkStream.cpp \
$${TOP}/src/Journal.cpp \
$${TOP}/src/Gui.cpp \
$${TOP}/src/PerfCounter.cpp \
$${TOP}/src/Calibration.cpp \
$${TOP}/src/settings.cpp \
$${TOP}/src/utils.cpp
HEADERS += \
$${TOP}/src/ImageProcessing.h \
$${TOP}/src/ImageAcquisition.h \
$${TOP}/src/Journal.h \
$${TOP}/src/PerfCounter.h \
$${TOP}/src/Calibration.h \
$${TOP}/src/settings.h \
$${TOP}/src/utils.h \
$${TOP}/src/NetworkStream.h \
$${TOP}/src/Gui.h \
$${TOP}/excuse/algo.h \
$${TOP}/excuse/bw_select.h \
$${TOP}/excuse/canny_ml.h \
$${TOP}/excuse/canny_neu.h \
$${TOP}/excuse/find_best_edge.h \
$${TOP}/excuse/get_curves.h \
$${TOP}/excuse/hypot.h \
$${TOP}/excuse/optimize_pos.h \
$${TOP}/excuse/peek.h \
$${TOP}/excuse/remove_points_with_low_angle.h \
$${TOP}/excuse/rgb2gray_matlab.h \
$${TOP}/excuse/stdafx.h \
$${TOP}/excuse/targetver.h \
$${TOP}/excuse/th_angular_histo.h \
$${TOP}/excuse/zero_around_region_th_border.h \
$${TOP}/else/algo.h \
$${TOP}/else/blob_gen.h \
$${TOP}/else/canny_impl.h \
$${TOP}/else/filter_edges.h \
$${TOP}/else/find_best_edge.h
FORMS += \
$${TOP}/src/Gui.ui
INCLUDEPATH += $${TOP}/src
RESOURCES += \
$${TOP}/resources.qrc
win32: RC_ICONS = $${TOP}/icons/eyerec.ico
Debug:DBG_SUFFIX = "d"
CV_SUFFIX=300
OPENCV_INC_DIR = $${TOP}/deps/opencv3.0.0/include
OPENCV_LIB_DIR = $${TOP}/deps/opencv3.0.0/x86/vc11/lib
INCLUDEPATH += "$${OPENCV_INC_DIR}"
LIBS += "-L$${OPENCV_LIB_DIR}"
LIBS += \
-lopencv_calib3d$${CV_SUFFIX} \
-lopencv_core$${CV_SUFFIX} \
-lopencv_highgui$${CV_SUFFIX} \
-lopencv_imgcodecs$${CV_SUFFIX} \
-lopencv_imgproc$${CV_SUFFIX} \
-lopencv_videoio$${CV_SUFFIX}
VIDEOMAN_INC_DIR = $${TOP}/deps/VideoMan1.1/include
VIDEOMAN_LIB_DIR = $${TOP}/deps/VideoMan1.1/bin
INCLUDEPATH += "$${VIDEOMAN_INC_DIR}"
LIBS += "-L$${VIDEOMAN_LIB_DIR}"
LIBS += -lVideoMan$${DBG_SUFFIX}
contains(DEFINES, STARBURST) {
SOURCES += $${TOP}/starburst/Starburst.cpp
HEADERS += $${TOP}/starburst/Starburst.h
}
contains(DEFINES, SWIRSKI) {
SOURCES += $${TOP}/swirski/Swirski.cpp
HEADERS += $${TOP}/swirski/Swirski.h
TBB_INC_DIR = $${TOP}/deps/tbb43/include
TBB_LIB_DIR = $${TOP}/deps/tbb43/lib/ia32/vc11
INCLUDEPATH += "$${TBB_INC_DIR}"
LIBS += "-L$${TBB_LIB_DIR}"
LIBS += -ltbb
}
cmake_minimum_required(VERSION 2.4)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
PROJECT( VideoMan )
SET ( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
SET ( CMAKE_DEBUG_POSTFIX d )
IF ( NOT VideoMan_3rdParty )
SET ( LIBRARY_OUTPUT_PATH ${VideoMan_BINARY_DIR}/bin/ CACHE PATH "Single output directory for building all libraries." FORCE )
SET ( EXECUTABLE_OUTPUT_PATH ${VideoMan_BINARY_DIR}/bin/ CACHE PATH "Single output directory for building all executables." FORCE )
ENDIF()
set_property(GLOBAL PROPERTY USE_FOLDERS On)
INCLUDE_DIRECTORIES( include )
option(VIDEOMAN_BUILD_OPENGL_RENDERER "Use OpenGL Renderer" ON)
IF ( VIDEOMAN_BUILD_OPENGL_RENDERER )
FIND_PACKAGE( OpenGL )
add_definitions(-DVM_OGLRenderer)
INCLUDE_DIRECTORIES( ${OPENGL_INCLUDE_DIR} )
ENDIF ( VIDEOMAN_BUILD_OPENGL_RENDERER )
LINK_DIRECTORIES(
)
SET( VideoMan_SRCS
control/VideoManControl.cpp
include/VideoManControl.h
control/VideoManControlPrivate.h
control/VideoManFactory.cpp
control/VideoManFactory.h
control/VideoManInputFormat.cpp
include/VideoManInputFormat.h
)
SET( VideoMan_SRCS_INPUTS
control/inputs/UserInput.cpp
control/inputs/UserInput.h
control/inputs/VideoManInputController.cpp
include/VideoManInputController.h
include/VideoInput.h
)
SET( VideoMan_SRCS_RENDERER
control/renderers/VideoManRenderer.cpp
control/renderers/VideoManRenderer.h
)
IF ( VIDEOMAN_BUILD_OPENGL_RENDERER )
SET( VideoMan_SRCS_RENDERER
${VideoMan_SRCS_RENDERER}
control/renderers/VideoManRendererOGL.cpp
control/renderers/VideoManRendererOGL.h
)
ENDIF ( VIDEOMAN_BUILD_OPENGL_RENDERER )
SOURCE_GROUP(inputs FILES ${VideoMan_SRCS_INPUTS})
SOURCE_GROUP(renderer FILES ${VideoMan_SRCS_RENDERER})
ADD_LIBRARY( VideoMan SHARED
${VideoMan_SRCS}
${VideoMan_SRCS_INPUTS}
${VideoMan_SRCS_RENDERER}
)
SET_PROPERTY(TARGET VideoMan PROPERTY LINK_INTERFACE_LIBRARIES "")
IF ( VIDEOMAN_BUILD_OPENGL_RENDERER )
TARGET_LINK_LIBRARIES( VideoMan ${OPENGL_LIBRARIES} )
ENDIF ( VIDEOMAN_BUILD_OPENGL_RENDERER )
add_subdirectory( inputs )
option(VIDEOMAN_BUILD_EXAMPLES "Build examples" ON)
option(VIDEOMAN_BUILD_EXAMPLES_OPENCV "Build examples using OpenCV" ON)
IF(VIDEOMAN_BUILD_OPENGL_RENDERER)
option(VIDEOMAN_BUILD_EXAMPLES_GLUT "Build examples based on GLUT" ON)
option(VIDEOMAN_BUILD_EXAMPLES_SFML "Build examples based on SFML" ON)
option(VIDEOMAN_BUILD_EXAMPLES_QT "Build examples based on QT" OFF)
option(VIDEOMAN_BUILD_EXAMPLES_CUDA "Build examples using CUDA" OFF)
ENDIF ( VIDEOMAN_BUILD_OPENGL_RENDERER )
IF ( NOT VIDEOMAN_BUILD_EXAMPLES)
SET( VIDEOMAN_BUILD_EXAMPLES_OPENCV OFF CACHE BOOL "" FORCE )
SET( VIDEOMAN_BUILD_EXAMPLES_GLUT OFF CACHE BOOL "" FORCE )
SET( VIDEOMAN_BUILD_EXAMPLES_SFML OFF CACHE BOOL "" FORCE )
SET( VIDEOMAN_BUILD_EXAMPLES_QT OFF CACHE BOOL "" FORCE )
SET( VIDEOMAN_BUILD_EXAMPLES_CUDA OFF CACHE BOOL "" FORCE )
ENDIF ( NOT VIDEOMAN_BUILD_EXAMPLES )
IF(NOT VIDEOMAN_BUILD_OPENGL_RENDERER)
SET( VIDEOMAN_BUILD_EXAMPLES_GLUT OFF CACHE BOOL "" FORCE )
SET( VIDEOMAN_BUILD_EXAMPLES_SFML OFF CACHE BOOL "" FORCE )
SET( VIDEOMAN_BUILD_EXAMPLES_QT OFF CACHE BOOL "" FORCE )
SET( VIDEOMAN_BUILD_EXAMPLES_CUDA OFF CACHE BOOL "" FORCE )
ENDIF(NOT VIDEOMAN_BUILD_OPENGL_RENDERER)
IF(VIDEOMAN_BUILD_EXAMPLES)
add_subdirectory( examples )
ENDIF(VIDEOMAN_BUILD_EXAMPLES)
#------ FindVideoMan.cmake ---------
set(${PROJECT_NAME}_VERSION "1.1.0" )
string(REGEX MATCHALL "[0-9]" ${PROJECT_NAME}_VERSION_PARTS "${${PROJECT_NAME}_VERSION}" )
list(GET ${PROJECT_NAME}_VERSION_PARTS 0 ${PROJECT_NAME}_VERSION_MAJOR)
list(GET ${PROJECT_NAME}_VERSION_PARTS 1 ${PROJECT_NAME}_VERSION_MINOR)
list(GET ${PROJECT_NAME}_VERSION_PARTS 2 ${PROJECT_NAME}_VERSION_PATCH)
set(${PROJECT_NAME}_SOVERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}" )
#set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME})
set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE ${PROJECT_SOURCE_DIR}/include/)
#set(CMAKE_LIB_DIRS_CONFIGCMAKE ${CMAKE_INSTALL_PREFIX}/lib CACHE PATH "Output directory for libraries" )
set(CMAKE_LIB_DIRS_CONFIGCMAKE ${VideoMan_BINARY_DIR}/bin/ )
set( VideoMan_DEBUG_POSTFIX d)
CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/config.cmake.in" "${VideoMan_BINARY_DIR}/${PROJECT_NAME}Config.cmake" @ONLY)
SET( $ENV{VideoMan_DIR} ${PROJECT_BINARY_DIR} )
Changes in Videoman 1.1:
-General:
* Namespace VideoMan
* New Naming convention
* Better documentation
-Inputs:
* VMIDSFalcon for IDS Falcon framegrabbers
* VMIDSuEye for IDS uEye cameras
* VMImageFile for loading an image with OpenCV
-Examples:
* New example with Qt
* IDS uEye cameras
* Nvidia CUDA
* PointGrey cameras
* Example with VMImageSequence
* Glut replaced by Freeglut
* PointGrey example using SFML
\ No newline at end of file
# ===================================================================================
# VideoMan CMake configuration file
#
# ** File generated automatically, do not modify **
#
# Usage from an external project:
# In your CMakeLists.txt, add these lines:
#
# FIND_PACKAGE(VideoMan REQUIRED )
# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${VideoMan_LIBS})
#
# This file will define the following variables:
# - VideoMan_LIBS : The list of libraries to links against.
# - VideoMan_LIB_DIR : The directory where lib files are. Calling LINK_DIRECTORIES
# with this path is NOT needed.
# - VideoMan_VERSION : The version of this gu build. Example: "1.2.0"
# - VideoMan_VERSION_MAJOR : Major version part of gu_VERSION. Example: "1"
# - VideoMan_VERSION_MINOR : Minor version part of gu_VERSION. Example: "2"
# - VideoMan_VERSION_PATCH : Patch version part of gu_VERSION. Example: "0"
#
# ===================================================================================
OPTION (VIDEOMAN_INCLUDE_PROJECT "Include VideoMan project to the solution" OFF )
# Extract the directory where *this* file has been installed (determined at cmake run-time)
# This variable may or may not be used below, depending on the parsing of VideoManConfig.cmake
get_filename_component(THIS_VideoMan_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
SET( VideoMan_3rdParty TRUE )
# ======================================================
# Include directories to add to the user project:
# ======================================================
INCLUDE_DIRECTORIES(@CMAKE_INCLUDE_DIRS_CONFIGCMAKE@)
# ======================================================
# Link directories to add to the user project:
# ======================================================
IF (VIDEOMAN_INCLUDE_PROJECT)
LINK_DIRECTORIES("${CMAKE_BINARY_DIR}/bin" )
# Provide the libs directory anyway, it may be needed in some cases.
SET(VideoMan_LIB_DIR "${CMAKE_BINARY_DIR}/bin" )
ELSE(VIDEOMAN_INCLUDE_PROJECT)
LINK_DIRECTORIES( @CMAKE_BINARY_DIR@/bin )
# Provide the libs directory anyway, it may be needed in some cases.
SET(VideoMan_LIB_DIR "@CMAKE_BINARY_DIR@/bin" )
ENDIF(VIDEOMAN_INCLUDE_PROJECT)
# ====================================================================
# Link libraries
# ====================================================================
if (CMAKE_MAJOR_VERSION GREATER 2 OR CMAKE_MINOR_VERSION GREATER 4) # CMake>=2.6 supports the notation "debug XXd optimized XX"
SET(VideoMan_LIBS debug VideoMan@VideoMan_DLLVERSION@@VideoMan_DEBUG_POSTFIX@ optimized VideoMan@VideoMan_DLLVERSION@)
else() # Old CMake:
SET(VideoMan_LIBS VideoMan@VideoMan_DLLVERSION@)
endif()
# ======================================================
# Version variables:
# ======================================================
SET(VideoMan_VERSION @VideoMan_VERSION@)
SET(VideoMan_VERSION_MAJOR @VideoMan_VERSION_MAJOR@)
SET(VideoMan_VERSION_MINOR @VideoMan_VERSION_MINOR@)
SET(VideoMan_VERSION_PATCH @VideoMan_VERSION_PATCH@)
IF (NOT TARGET VideoMan)
IF (VIDEOMAN_INCLUDE_PROJECT)
add_subdirectory("@PROJECT_SOURCE_DIR@" ${CMAKE_BINARY_DIR}/VideoMan)
ENDIF(VIDEOMAN_INCLUDE_PROJECT)
ENDIF (NOT TARGET VideoMan)
#ifndef VIDEOINPUT_H
#define VIDEOINPUT_H
#include "VideoManInputFormat.h"
#include "VideoManInputController.h"
namespace VideoManPrivate
{
class VideoInput
{
public:
//format must be completed when the input is initialized
VideoInput( void )
{
pixelBuffer = NULL;
callback = NULL;
roiMode = false;
}
virtual ~VideoInput( void )
{
if ( identification.uniqueName )
delete identification.uniqueName;
identification.uniqueName = NULL;
if ( identification.friendlyName )
delete identification.friendlyName;
identification.friendlyName = NULL;
if ( identification.identifier )
delete identification.identifier;
identification.identifier = NULL;
if ( identification.fileName )
delete identification.fileName;
identification.fileName = NULL;
};
/** \brief Get the format of the video input
*/
VideoMan::VMInputFormat getVideoManInputFormat(){ return format; }
/** \brief Get a new frame
\param wait [in] if it must wait for next sample or not
\return the frame of the video
*/
virtual char *getFrame( bool wait = false) = 0;
virtual VideoManPrivate::VideoManInputController *getController(){ return NULL; }
virtual bool linkController( VideoManPrivate::VideoManInputController *controller ){return false;}
virtual void releaseFrame(){}
char* pixelBuffer; //The last captured frame
VideoMan::VMInputIdentification getIdentification()
{
return identification;
}
typedef void (*getFrameCallback)( char *pixelBuffer, size_t input, double timestamp, void *data );
virtual void setFrameCallback( getFrameCallback theCallback, void *data )
{
callback = theCallback;
frameCallbackData = data;
}
virtual bool supportFrameCallback()
{
return false;
}
/** VIDEO FILE METHODS **/
virtual void play(){}
virtual void pause(){}
virtual void stop(){}
virtual double getLengthSeconds(){return 0;}
virtual int getLengthFrames(){return 0;}
virtual double getPositionSeconds(){return 0;}
virtual int getPositionFrames(){return 0;}
virtual void goToFrame( int frame ){}
virtual void goToMilisecond( double milisecond ){}
/** CAPTURE DEVICES METHODS **/
virtual void showPropertyPage(){}
/** USER INPUT METHODS **/
virtual void setImage( char *image ){}
void setInputID( size_t input ){inputID = input;}
bool isRoiModeEnabled(){ return roiMode; }
void getImageRoi( int &x, int &y, int &width, int &height )
{
x = xRoi;
y = yRoi;
width = wRoi;
height = hRoi;
}
protected:
VideoMan::VMInputFormat format; //The internal format of the frames
VideoMan::VMInputIdentification identification; //The information about the input (must be released by the input module)
bool frameCaptured; //if a frame was already captured
getFrameCallback callback;
/** VIDEO FILES MEMBERS **/
int videoLengthFrames;
double videoLengthSeconds;
size_t inputID;
void *frameCallbackData;
bool roiMode;
int xRoi, yRoi, wRoi, hRoi;
};
};
#endif
#ifndef VIDEOMANCONTROL_H
#define VIDEOMANCONTROL_H
#ifdef WIN32
#ifdef VideoMan_EXPORTS
#define VIDEOMAN_API __declspec(dllexport)
#else
#define VIDEOMAN_API __declspec(dllimport)
#endif
#endif
#ifdef linux
#define VIDEOMAN_API
#endif
#include "VideoManInputFormat.h"
namespace VideoManPrivate
{
class VideoManControlPrivate;
class VideoManInputController;
};
/*! \mainpage Wellcome to VideoMan
*
* http://videomanlib.sourceforge.net/
*/
/** \brief Library's namespace
*/
namespace VideoMan
{
/** \brief Texture filtering options
*/
enum VMTextureFiltering{ VM_NEAREST = 0, VM_LINEAR = 1};
/** \brief Control class
With this class you can create and control the video inputs and also control the renderer:
- You can initialize a video input from a video file:
\code
device.identifier = "DSHOW_VIDEO_FILE";
device.fileName = "C:/videos/video.avi";
videoInputID = videoMan.addVideoInput( device, NULL );
...
char * image = videoMan.getFrame( videoInputID );
...
videoMan.releaseFrame( videoInputID );
\endcode
- Initialize a video input from a capture device:
\code
videoMan.getAvailableDevices( list, numDevices );
if ( numDevices > 0 )
{
device = list[0];
format.SetFormat( 640, 320,30, RGB24, RGB24 );
videoInputID = videoMan.addVideoInput( device, &format );
}
videoMan.freeAvailableDevicesList( list, numDevices );
\endcode
- Display the image in an OpenGL window. The OpenGL context should be created before you create the inputs:
\code
videoMan.getFrame( videoInputID );
videoMan.updateTexture( videoInputID );
videoMan.releaseFrame( videoInputID );
videoMan.renderFrame( videoInputID );
\endcode
- If you don't need to display the images or you prefer to use other system to display the image, you can create VideoMan without renderer:
\code
videoMan = new VideoManControl( NO_RENDERER );
\endcode
This class contains the methods that are common to all the input modules. If you want to use functions of a specific input module, for example
to configure the trigger of an industrial camera, you can use the controllers, see VideoManControl::createController
*/
class VIDEOMAN_API VideoManControl
{
private:
VideoManControl(const VideoManControl &);
VideoManControl & operator=(const VideoManControl &);
public:
/** \brief Render type otions
*/
enum VMRendererType{ NO_RENDERER /** Don't create renderer */, OPENGL_RENDERER /** Create OpenGL Renderer */ };
/** \param rendererType [in] If VideoMan will use renderer to display the images or not
*/
VideoManControl( VMRendererType rendererType = OPENGL_RENDERER );
/**
*/
~VideoManControl(void);
/** \brief Template for the frame callback
\param pixelBuffer [in] the image data
\param input [in] the input identifier that generates the callback
\param timestamp [in] Timestamp of the frame
\param data [in] User data from VideoManControl::setFrameCallback
*/
typedef void (*frameCallback)( char *pixelBuffer, size_t input, double timestamp, void *data );
//! \name Input Modules info
//@{
/** \brief Get the list of identifiers supported by the input modules
The user should must call to freeSupportedIdentifiersList
\param identifiers [out] list of identifiers
\param numIdentifiers [out] Number of supported identifers
*/
void getSupportedIdentifiers( char **&identifiers, int &numIdentifiers );