Created a library find_object for convenience
Updated version to 0.5.0 git-svn-id: http://find-object.googlecode.com/svn/trunk/find_object@357 620bd6b2-0a58-f614-fd9a-1bd335dccda9
This commit is contained in:
parent
680b1740b1
commit
9bc7c15abc
@ -13,7 +13,7 @@ ENDIF(NOT WIN32)
|
|||||||
#######################
|
#######################
|
||||||
# VERSION
|
# VERSION
|
||||||
#######################
|
#######################
|
||||||
SET(PROJECT_VERSION "0.4.6")
|
SET(PROJECT_VERSION "0.5.0")
|
||||||
ADD_DEFINITIONS(-DPROJECT_VERSION="${PROJECT_VERSION}")
|
ADD_DEFINITIONS(-DPROJECT_VERSION="${PROJECT_VERSION}")
|
||||||
|
|
||||||
STRING(REGEX MATCHALL "[0-9]" PROJECT_VERSION_PARTS "${PROJECT_VERSION}")
|
STRING(REGEX MATCHALL "[0-9]" PROJECT_VERSION_PARTS "${PROJECT_VERSION}")
|
||||||
@ -34,11 +34,46 @@ ENDIF(${CMAKE_GENERATOR} MATCHES ".*Makefiles")
|
|||||||
|
|
||||||
SET(CMAKE_DEBUG_POSTFIX "d")
|
SET(CMAKE_DEBUG_POSTFIX "d")
|
||||||
|
|
||||||
|
####### Build libraries as shared or static #######
|
||||||
|
OPTION( BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON )
|
||||||
|
|
||||||
|
####### SET RPATH #########
|
||||||
|
# When RPATH is activated (supported on most UNIX systems),
|
||||||
|
# the user doesn't need to change LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
# use, i.e. don't skip the full RPATH for the build tree
|
||||||
|
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||||
|
|
||||||
|
# when building, don't use the install RPATH already
|
||||||
|
# (but later on when installing)
|
||||||
|
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||||
|
|
||||||
|
# the RPATH to be used when installing
|
||||||
|
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_PREFIX}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
|
||||||
|
|
||||||
|
# add the automatically determined parts of the RPATH
|
||||||
|
# which point to directories outside the build tree to the install RPATH
|
||||||
|
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
|
|
||||||
####### OUTPUT DIR #######
|
####### OUTPUT DIR #######
|
||||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
|
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
|
||||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
|
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
|
||||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
|
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
|
||||||
|
|
||||||
|
####### INSTALL DIR #######
|
||||||
|
# Offer the user the choice of overriding the installation directories
|
||||||
|
set(INSTALL_LIB_DIR lib/${PROJECT_PREFIX}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} CACHE PATH "Installation directory for libraries")
|
||||||
|
set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
|
||||||
|
set(INSTALL_INCLUDE_DIR include/${PROJECT_PREFIX}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} CACHE PATH
|
||||||
|
"Installation directory for header files")
|
||||||
|
if(WIN32 AND NOT CYGWIN)
|
||||||
|
set(DEF_INSTALL_CMAKE_DIR CMake)
|
||||||
|
else()
|
||||||
|
set(DEF_INSTALL_CMAKE_DIR lib/${PROJECT_PREFIX}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
|
||||||
|
endif()
|
||||||
|
set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH
|
||||||
|
"Installation directory for CMake files")
|
||||||
|
|
||||||
####### DEPENDENCIES #######
|
####### DEPENDENCIES #######
|
||||||
FIND_PACKAGE(OpenCV REQUIRED) # tested on 2.3.1
|
FIND_PACKAGE(OpenCV REQUIRED) # tested on 2.3.1
|
||||||
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtNetwork) # tested on Qt4.7
|
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtNetwork) # tested on Qt4.7
|
||||||
@ -63,6 +98,7 @@ IF(APPLE AND BUILD_AS_BUNDLE)
|
|||||||
ENDIF(APPLE AND BUILD_AS_BUNDLE)
|
ENDIF(APPLE AND BUILD_AS_BUNDLE)
|
||||||
|
|
||||||
####### SOURCES (Projects) #######
|
####### SOURCES (Projects) #######
|
||||||
|
ADD_SUBDIRECTORY( src )
|
||||||
ADD_SUBDIRECTORY( app )
|
ADD_SUBDIRECTORY( app )
|
||||||
ADD_SUBDIRECTORY( example )
|
ADD_SUBDIRECTORY( example )
|
||||||
ADD_SUBDIRECTORY( tcpClient )
|
ADD_SUBDIRECTORY( tcpClient )
|
||||||
@ -82,6 +118,36 @@ CONFIGURE_FILE(
|
|||||||
ADD_CUSTOM_TARGET(uninstall
|
ADD_CUSTOM_TARGET(uninstall
|
||||||
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# Setup FindObjectConfig.cmake
|
||||||
|
#######################
|
||||||
|
# Create the FindObjectConfig.cmake and FindObjectConfigVersion files
|
||||||
|
file(RELATIVE_PATH REL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}" "${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR}")
|
||||||
|
file(RELATIVE_PATH REL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}" "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR}")
|
||||||
|
|
||||||
|
# ... for the build tree
|
||||||
|
set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include")
|
||||||
|
set(CONF_LIB_DIR "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
|
||||||
|
configure_file(FindObjectConfig.cmake.in
|
||||||
|
"${PROJECT_BINARY_DIR}/FindObjectConfig.cmake" @ONLY)
|
||||||
|
|
||||||
|
# ... for the install tree
|
||||||
|
set(CONF_INCLUDE_DIRS "\${FindObject_CMAKE_DIR}/${REL_INCLUDE_DIR}")
|
||||||
|
set(CONF_LIB_DIR "\${FindObject_CMAKE_DIR}/${REL_LIB_DIR}")
|
||||||
|
configure_file(FindObjectConfig.cmake.in
|
||||||
|
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindObjectConfig.cmake" @ONLY)
|
||||||
|
|
||||||
|
# ... for both
|
||||||
|
configure_file(FindObjectConfigVersion.cmake.in
|
||||||
|
"${PROJECT_BINARY_DIR}/FindObjectConfigVersion.cmake" @ONLY)
|
||||||
|
|
||||||
|
# Install the FindObjectConfig.cmake and FindObjectConfigVersion.cmake
|
||||||
|
install(FILES
|
||||||
|
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindObjectConfig.cmake"
|
||||||
|
"${PROJECT_BINARY_DIR}/FindObjectConfigVersion.cmake"
|
||||||
|
DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT devel)
|
||||||
|
####
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# CPACK (Packaging)
|
# CPACK (Packaging)
|
||||||
#######################
|
#######################
|
||||||
|
|||||||
10
FindObjectConfig.cmake.in
Normal file
10
FindObjectConfig.cmake.in
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# - Config file for the FindObject package
|
||||||
|
# It defines the following variables
|
||||||
|
# FindObject_INCLUDE_DIRS - include directories for FindObject
|
||||||
|
# FindObject_LIBRARIES - libraries to link against
|
||||||
|
|
||||||
|
# Compute paths
|
||||||
|
get_filename_component(FindObject_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
|
set(FindObject_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
|
||||||
|
|
||||||
|
find_library(FindObject_LIBRARIES NAMES find_object NO_DEFAULT_PATH HINTS "@CONF_LIB_DIR@")
|
||||||
11
FindObjectConfigVersion.cmake.in
Normal file
11
FindObjectConfigVersion.cmake.in
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
set(PACKAGE_VERSION "@PROJECT_VERSION@")
|
||||||
|
|
||||||
|
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
||||||
|
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||||
|
else()
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||||
|
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
|
||||||
|
set(PACKAGE_VERSION_EXACT TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
@ -1,74 +1,8 @@
|
|||||||
|
|
||||||
|
|
||||||
### Qt Gui stuff ###
|
|
||||||
SET(headers_ui
|
|
||||||
../src/MainWindow.h
|
|
||||||
../src/AddObjectDialog.h
|
|
||||||
../src/ObjWidget.h
|
|
||||||
../src/FindObject.h
|
|
||||||
../src/Camera.h
|
|
||||||
../src/CameraTcpClient.h
|
|
||||||
../src/ParametersToolBox.h
|
|
||||||
../src/AboutDialog.h
|
|
||||||
../src/TcpServer.h
|
|
||||||
../src/RectItem.h
|
|
||||||
../src/utilite/UPlot.h
|
|
||||||
../src/rtabmap/PdfPlot.h
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(uis
|
|
||||||
../src/ui/mainWindow.ui
|
|
||||||
../src/ui/addObjectDialog.ui
|
|
||||||
../src/ui/aboutDialog.ui
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(qrc
|
|
||||||
../src/resources.qrc
|
|
||||||
)
|
|
||||||
|
|
||||||
# generate rules for building source files from the resources
|
|
||||||
QT4_ADD_RESOURCES(srcs_qrc ${qrc})
|
|
||||||
|
|
||||||
#Generate .h files from the .ui files
|
|
||||||
QT4_WRAP_UI(moc_uis ${uis})
|
|
||||||
|
|
||||||
#This will generate moc_* for Qt
|
|
||||||
QT4_WRAP_CPP(moc_srcs ${headers_ui})
|
|
||||||
### Qt Gui stuff end###
|
|
||||||
|
|
||||||
|
|
||||||
SET(SRC_FILES
|
|
||||||
./main.cpp
|
|
||||||
../src/MainWindow.cpp
|
|
||||||
../src/AddObjectDialog.cpp
|
|
||||||
../src/KeypointItem.cpp
|
|
||||||
../src/RectItem.cpp
|
|
||||||
../src/QtOpenCV.cpp
|
|
||||||
../src/Camera.cpp
|
|
||||||
../src/CameraTcpClient.cpp
|
|
||||||
../src/ParametersToolBox.cpp
|
|
||||||
../src/Settings.cpp
|
|
||||||
../src/ObjWidget.cpp
|
|
||||||
../src/FindObject.cpp
|
|
||||||
../src/AboutDialog.cpp
|
|
||||||
../src/TcpServer.cpp
|
|
||||||
../src/Vocabulary.cpp
|
|
||||||
../src/utilite/ULogger.cpp
|
|
||||||
../src/utilite/UPlot.cpp
|
|
||||||
../src/utilite/UDirectory.cpp
|
|
||||||
../src/utilite/UFile.cpp
|
|
||||||
../src/utilite/UConversion.cpp
|
|
||||||
../src/rtabmap/PdfPlot.cpp
|
|
||||||
${moc_srcs}
|
|
||||||
${moc_uis}
|
|
||||||
${srcs_qrc}
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(INCLUDE_DIRS
|
SET(INCLUDE_DIRS
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../src
|
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${OpenCV_INCLUDE_DIRS}
|
${OpenCV_INCLUDE_DIRS}
|
||||||
${CMAKE_CURRENT_BINARY_DIR} # for qt ui generated in binary dir
|
|
||||||
)
|
)
|
||||||
|
|
||||||
INCLUDE(${QT_USE_FILE})
|
INCLUDE(${QT_USE_FILE})
|
||||||
@ -106,30 +40,30 @@ ENDIF(WIN32)
|
|||||||
|
|
||||||
# create an executable file
|
# create an executable file
|
||||||
IF(APPLE AND BUILD_AS_BUNDLE)
|
IF(APPLE AND BUILD_AS_BUNDLE)
|
||||||
ADD_EXECUTABLE(find_object MACOSX_BUNDLE ${SRC_FILES})
|
ADD_EXECUTABLE(find_object_app MACOSX_BUNDLE main.cpp)
|
||||||
ELSEIF(MINGW)
|
ELSEIF(MINGW)
|
||||||
ADD_EXECUTABLE(find_object WIN32 ${SRC_FILES})
|
ADD_EXECUTABLE(find_object_app WIN32 main.cpp)
|
||||||
ELSE()
|
ELSE()
|
||||||
ADD_EXECUTABLE(find_object ${SRC_FILES})
|
ADD_EXECUTABLE(find_object_app main.cpp)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
# Linking with Qt libraries
|
# Linking with Qt libraries
|
||||||
TARGET_LINK_LIBRARIES(find_object ${LIBRARIES})
|
TARGET_LINK_LIBRARIES(find_object_app find_object ${LIBRARIES})
|
||||||
|
|
||||||
IF(APPLE AND BUILD_AS_BUNDLE)
|
IF(APPLE AND BUILD_AS_BUNDLE)
|
||||||
SET_TARGET_PROPERTIES(find_object PROPERTIES
|
SET_TARGET_PROPERTIES(find_object_app PROPERTIES
|
||||||
OUTPUT_NAME ${CMAKE_BUNDLE_NAME})
|
OUTPUT_NAME ${CMAKE_BUNDLE_NAME})
|
||||||
ELSEIF(WIN32)
|
ELSEIF(WIN32)
|
||||||
SET_TARGET_PROPERTIES(find_object PROPERTIES
|
SET_TARGET_PROPERTIES(find_object_app PROPERTIES
|
||||||
OUTPUT_NAME ${PROJECT_NAME})
|
OUTPUT_NAME ${PROJECT_NAME})
|
||||||
ELSE()
|
ELSE()
|
||||||
SET_TARGET_PROPERTIES(find_object PROPERTIES
|
SET_TARGET_PROPERTIES(find_object_app PROPERTIES
|
||||||
OUTPUT_NAME ${PROJECT_PREFIX})
|
OUTPUT_NAME ${PROJECT_PREFIX})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
#---------------------------
|
#---------------------------
|
||||||
# Installation stuff
|
# Installation stuff
|
||||||
#---------------------------
|
#---------------------------
|
||||||
INSTALL(TARGETS find_object
|
INSTALL(TARGETS find_object_app
|
||||||
RUNTIME DESTINATION bin COMPONENT runtime
|
RUNTIME DESTINATION bin COMPONENT runtime
|
||||||
BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT runtime)
|
BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT runtime)
|
||||||
|
|
||||||
|
|||||||
12
app/main.cpp
12
app/main.cpp
@ -1,12 +1,12 @@
|
|||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
#include "MainWindow.h"
|
#include "find_object/MainWindow.h"
|
||||||
#include "Settings.h"
|
#include "find_object/Settings.h"
|
||||||
#include "FindObject.h"
|
#include "find_object/FindObject.h"
|
||||||
#include "Camera.h"
|
#include "find_object/Camera.h"
|
||||||
#include "TcpServer.h"
|
#include "find_object/TcpServer.h"
|
||||||
#include "utilite/ULogger.h"
|
#include "find_object/utilite/ULogger.h"
|
||||||
|
|
||||||
bool running = true;
|
bool running = true;
|
||||||
|
|
||||||
|
|||||||
@ -1,32 +1,12 @@
|
|||||||
### Qt Gui stuff ###
|
|
||||||
SET(headers_ui
|
|
||||||
../src/ObjWidget.h
|
|
||||||
../src/Camera.h
|
|
||||||
../src/CameraTcpClient.h
|
|
||||||
)
|
|
||||||
#This will generate moc_* for Qt
|
|
||||||
QT4_WRAP_CPP(moc_srcs ${headers_ui})
|
|
||||||
### Qt Gui stuff end###
|
|
||||||
|
|
||||||
SET(SRC_FILES
|
SET(SRC_FILES
|
||||||
main.cpp
|
main.cpp
|
||||||
../src/ObjWidget.cpp
|
|
||||||
../src/KeypointItem.cpp
|
|
||||||
../src/QtOpenCV.cpp
|
|
||||||
../src/Settings.cpp
|
|
||||||
../src/Camera.cpp
|
|
||||||
../src/CameraTcpClient.cpp
|
|
||||||
../src/utilite/UDirectory.cpp
|
|
||||||
../src/utilite/UFile.cpp
|
|
||||||
../src/utilite/ULogger.cpp
|
|
||||||
../src/utilite/UConversion.cpp
|
|
||||||
${moc_srcs}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(INCLUDE_DIRS
|
SET(INCLUDE_DIRS
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${OpenCV_INCLUDE_DIRS}
|
${OpenCV_INCLUDE_DIRS}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../src
|
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
||||||
)
|
)
|
||||||
|
|
||||||
INCLUDE(${QT_USE_FILE})
|
INCLUDE(${QT_USE_FILE})
|
||||||
@ -42,7 +22,7 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
|||||||
# Add binary called "example" that is built from the source file "main.cpp".
|
# Add binary called "example" that is built from the source file "main.cpp".
|
||||||
# The extension is automatically found.
|
# The extension is automatically found.
|
||||||
ADD_EXECUTABLE(example ${SRC_FILES})
|
ADD_EXECUTABLE(example ${SRC_FILES})
|
||||||
TARGET_LINK_LIBRARIES(example ${LIBRARIES})
|
TARGET_LINK_LIBRARIES(example find_object ${LIBRARIES})
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES( example
|
SET_TARGET_PROPERTIES( example
|
||||||
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-example)
|
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-example)
|
||||||
|
|||||||
@ -19,9 +19,9 @@
|
|||||||
#include <opencv2/nonfree/features2d.hpp>
|
#include <opencv2/nonfree/features2d.hpp>
|
||||||
#include <opencv2/calib3d/calib3d.hpp> // for homography
|
#include <opencv2/calib3d/calib3d.hpp> // for homography
|
||||||
|
|
||||||
// From this project (see src folder)
|
// From this project
|
||||||
#include "ObjWidget.h"
|
#include "find_object/ObjWidget.h"
|
||||||
#include "QtOpenCV.h"
|
#include "find_object/QtOpenCV.h"
|
||||||
|
|
||||||
void showUsage()
|
void showUsage()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
### Qt Gui stuff ###
|
### Qt Gui stuff ###
|
||||||
SET(headers_ui
|
SET(headers_ui
|
||||||
../src/Camera.h
|
|
||||||
../src/CameraTcpClient.h
|
|
||||||
ImagesTcpServer.h
|
ImagesTcpServer.h
|
||||||
)
|
)
|
||||||
#This will generate moc_* for Qt
|
#This will generate moc_* for Qt
|
||||||
@ -9,23 +7,15 @@ QT4_WRAP_CPP(moc_srcs ${headers_ui})
|
|||||||
### Qt Gui stuff end###
|
### Qt Gui stuff end###
|
||||||
|
|
||||||
SET(SRC_FILES
|
SET(SRC_FILES
|
||||||
../src/Camera.cpp
|
|
||||||
../src/CameraTcpClient.cpp
|
|
||||||
../src/Settings.cpp
|
|
||||||
../src/QtOpenCV.cpp
|
|
||||||
../src/utilite/UDirectory.cpp
|
|
||||||
../src/utilite/UFile.cpp
|
|
||||||
../src/utilite/ULogger.cpp
|
|
||||||
../src/utilite/UConversion.cpp
|
|
||||||
ImagesTcpServer.cpp
|
ImagesTcpServer.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
${moc_srcs}
|
${moc_srcs}
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(INCLUDE_DIRS
|
SET(INCLUDE_DIRS
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${OpenCV_INCLUDE_DIRS}
|
${OpenCV_INCLUDE_DIRS}
|
||||||
../src
|
|
||||||
)
|
)
|
||||||
|
|
||||||
INCLUDE(${QT_USE_FILE})
|
INCLUDE(${QT_USE_FILE})
|
||||||
@ -41,7 +31,7 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
|||||||
# Add binary called "example" that is built from the source file "main.cpp".
|
# Add binary called "example" that is built from the source file "main.cpp".
|
||||||
# The extension is automatically found.
|
# The extension is automatically found.
|
||||||
ADD_EXECUTABLE(imagesTcpServer ${SRC_FILES})
|
ADD_EXECUTABLE(imagesTcpServer ${SRC_FILES})
|
||||||
TARGET_LINK_LIBRARIES(imagesTcpServer ${LIBRARIES})
|
TARGET_LINK_LIBRARIES(imagesTcpServer find_object ${LIBRARIES})
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES( imagesTcpServer
|
SET_TARGET_PROPERTIES( imagesTcpServer
|
||||||
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-imagesTcpServer)
|
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-imagesTcpServer)
|
||||||
|
|||||||
@ -5,13 +5,14 @@
|
|||||||
* Author: mathieu
|
* Author: mathieu
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "find_object/Settings.h"
|
||||||
|
#include "find_object/QtOpenCV.h"
|
||||||
|
|
||||||
#include "ImagesTcpServer.h"
|
#include "ImagesTcpServer.h"
|
||||||
|
|
||||||
#include <QtNetwork/QNetworkInterface>
|
#include <QtNetwork/QNetworkInterface>
|
||||||
#include <QtNetwork/QTcpSocket>
|
#include <QtNetwork/QTcpSocket>
|
||||||
#include <QtGui/QTransform>
|
#include <QtGui/QTransform>
|
||||||
#include "Settings.h"
|
|
||||||
#include "QtOpenCV.h"
|
|
||||||
|
|
||||||
ImagesTcpServer::ImagesTcpServer(float hz, const QString & path, QObject * parent) :
|
ImagesTcpServer::ImagesTcpServer(float hz, const QString & path, QObject * parent) :
|
||||||
QTcpServer(parent)
|
QTcpServer(parent)
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
#ifndef TCPCLIENT_H_
|
#ifndef TCPCLIENT_H_
|
||||||
#define TCPCLIENT_H_
|
#define TCPCLIENT_H_
|
||||||
|
|
||||||
#include "Camera.h"
|
#include "find_object/Camera.h"
|
||||||
#include <QtNetwork/QTcpServer>
|
#include <QtNetwork/QTcpServer>
|
||||||
|
|
||||||
class ImagesTcpServer : public QTcpServer
|
class ImagesTcpServer : public QTcpServer
|
||||||
|
|||||||
@ -5,13 +5,16 @@
|
|||||||
#ifndef CAMERA_H_
|
#ifndef CAMERA_H_
|
||||||
#define CAMERA_H_
|
#define CAMERA_H_
|
||||||
|
|
||||||
|
#include "find_object/FindObjectExp.h" // DLL export/import defines
|
||||||
|
|
||||||
#include <opencv2/highgui/highgui.hpp>
|
#include <opencv2/highgui/highgui.hpp>
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <QtGui/QImage>
|
#include <QtGui/QImage>
|
||||||
#include "CameraTcpClient.h"
|
|
||||||
|
|
||||||
class Camera : public QObject {
|
class CameraTcpClient;
|
||||||
|
|
||||||
|
class FINDOBJECT_EXP Camera : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Camera(QObject * parent = 0);
|
Camera(QObject * parent = 0);
|
||||||
@ -42,7 +45,7 @@ private:
|
|||||||
QTimer cameraTimer_;
|
QTimer cameraTimer_;
|
||||||
QList<std::string> images_;
|
QList<std::string> images_;
|
||||||
unsigned int currentImageIndex_;
|
unsigned int currentImageIndex_;
|
||||||
CameraTcpClient cameraTcpClient_;
|
CameraTcpClient * cameraTcpClient_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CAMERA_H_ */
|
#endif /* CAMERA_H_ */
|
||||||
@ -8,6 +8,8 @@
|
|||||||
#ifndef FINDOBJECT_H_
|
#ifndef FINDOBJECT_H_
|
||||||
#define FINDOBJECT_H_
|
#define FINDOBJECT_H_
|
||||||
|
|
||||||
|
#include "find_object/FindObjectExp.h" // DLL export/import defines
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtCore/QMap>
|
#include <QtCore/QMap>
|
||||||
@ -24,7 +26,7 @@ class Vocabulary;
|
|||||||
class KeypointDetector;
|
class KeypointDetector;
|
||||||
class DescriptorExtractor;
|
class DescriptorExtractor;
|
||||||
|
|
||||||
class FindObject : public QObject
|
class FINDOBJECT_EXP FindObject : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
|
|
||||||
33
include/find_object/FindObjectExp.h
Normal file
33
include/find_object/FindObjectExp.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2010-2011, Mathieu Labbe and IntRoLab - Universite de Sherbrooke
|
||||||
|
*
|
||||||
|
* This file is part of RTAB-Map.
|
||||||
|
*
|
||||||
|
* RTAB-Map 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
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RTAB-Map 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 RTAB-Map. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FINDOBJECTEXP_H
|
||||||
|
#define FINDOBJECTEXP_H
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#if defined(find_object_EXPORTS)
|
||||||
|
#define FINDOBJECT_EXP __declspec( dllexport )
|
||||||
|
#else
|
||||||
|
#define FINDOBJECT_EXP __declspec( dllimport )
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define FINDOBJECT_EXP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // RTABMAPEXP_H
|
||||||
@ -5,6 +5,8 @@
|
|||||||
#ifndef MAINWINDOW_H_
|
#ifndef MAINWINDOW_H_
|
||||||
#define MAINWINDOW_H_
|
#define MAINWINDOW_H_
|
||||||
|
|
||||||
|
#include "find_object/FindObjectExp.h" // DLL export/import defines
|
||||||
|
|
||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
#include <QtCore/QSet>
|
#include <QtCore/QSet>
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
@ -31,7 +33,7 @@ namespace rtabmap
|
|||||||
class PdfPlotCurve;
|
class PdfPlotCurve;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class FINDOBJECT_EXP MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -5,6 +5,8 @@
|
|||||||
#ifndef OBJWIDGET_H_
|
#ifndef OBJWIDGET_H_
|
||||||
#define OBJWIDGET_H_
|
#define OBJWIDGET_H_
|
||||||
|
|
||||||
|
#include "find_object/FindObjectExp.h" // DLL export/import defines
|
||||||
|
|
||||||
#include <opencv2/features2d/features2d.hpp>
|
#include <opencv2/features2d/features2d.hpp>
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
#include <QtCore/QMultiMap>
|
#include <QtCore/QMultiMap>
|
||||||
@ -19,7 +21,7 @@ class QGraphicsRectItem;
|
|||||||
class QGraphicsItem;
|
class QGraphicsItem;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
|
|
||||||
class ObjWidget : public QWidget
|
class FINDOBJECT_EXP ObjWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
25
include/find_object/QtOpenCV.h
Normal file
25
include/find_object/QtOpenCV.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef QTOPENCV_H
|
||||||
|
#define QTOPENCV_H
|
||||||
|
|
||||||
|
#include "find_object/FindObjectExp.h" // DLL export/import defines
|
||||||
|
|
||||||
|
#include <QtGui/QImage>
|
||||||
|
#include <opencv2/core/core.hpp>
|
||||||
|
|
||||||
|
// Convert OpenCV matrix to QImage
|
||||||
|
QImage FINDOBJECT_EXP cvtCvMat2QImage(const cv::Mat & image, bool isBgr = true);
|
||||||
|
|
||||||
|
// Convert QImage to OpenCV matrix
|
||||||
|
cv::Mat FINDOBJECT_EXP cvtQImage2CvMat(const QImage & image);
|
||||||
|
|
||||||
|
// Convert IplImage to QImage
|
||||||
|
QImage FINDOBJECT_EXP cvtIplImage2QImage(const IplImage * image);
|
||||||
|
|
||||||
|
// Convert QImage to IplImage
|
||||||
|
IplImage * FINDOBJECT_EXP cvtQImage2IplImage(const QImage & image);
|
||||||
|
|
||||||
|
#endif // QTOPENCV_H
|
||||||
@ -5,6 +5,8 @@
|
|||||||
#ifndef SETTINGS_H_
|
#ifndef SETTINGS_H_
|
||||||
#define SETTINGS_H_
|
#define SETTINGS_H_
|
||||||
|
|
||||||
|
#include "find_object/FindObjectExp.h" // DLL export/import defines
|
||||||
|
|
||||||
#include <QtCore/QMap>
|
#include <QtCore/QMap>
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
#include <QtCore/QByteArray>
|
#include <QtCore/QByteArray>
|
||||||
@ -55,7 +57,7 @@ typedef unsigned int uint;
|
|||||||
Dummy##PREFIX##_##NAME dummy##PREFIX##_##NAME;
|
Dummy##PREFIX##_##NAME dummy##PREFIX##_##NAME;
|
||||||
// MACRO END
|
// MACRO END
|
||||||
|
|
||||||
class Settings
|
class FINDOBJECT_EXP Settings
|
||||||
{
|
{
|
||||||
PARAMETER(Camera, 1deviceId, int, 0, "Device ID (default 0).");
|
PARAMETER(Camera, 1deviceId, int, 0, "Device ID (default 0).");
|
||||||
PARAMETER(Camera, 2imageWidth, int, 640, "Image width (0 means default width from camera).");
|
PARAMETER(Camera, 2imageWidth, int, 640, "Image width (0 means default width from camera).");
|
||||||
@ -8,11 +8,13 @@
|
|||||||
#ifndef TCPSERVER_H_
|
#ifndef TCPSERVER_H_
|
||||||
#define TCPSERVER_H_
|
#define TCPSERVER_H_
|
||||||
|
|
||||||
|
#include "find_object/FindObjectExp.h" // DLL export/import defines
|
||||||
|
|
||||||
#include <QtNetwork/QTcpServer>
|
#include <QtNetwork/QTcpServer>
|
||||||
|
|
||||||
class QNetworkSession;
|
class QNetworkSession;
|
||||||
|
|
||||||
class TcpServer : public QTcpServer
|
class FINDOBJECT_EXP TcpServer : public QTcpServer
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -20,10 +20,10 @@
|
|||||||
#ifndef ULOGGER_H
|
#ifndef ULOGGER_H
|
||||||
#define ULOGGER_H
|
#define ULOGGER_H
|
||||||
|
|
||||||
//#include "utilite/UtiLiteExp.h" // DLL export/import defines
|
#include "find_object/FindObjectExp.h" // DLL export/import defines
|
||||||
|
|
||||||
#include "utilite/UMutex.h"
|
#include "find_object/utilite/UMutex.h"
|
||||||
#include "utilite/UDestroyer.h"
|
#include "find_object/utilite/UDestroyer.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -190,7 +190,7 @@
|
|||||||
* @see UDEBUG(), UINFO(), UWARN(), UERROR(), UFATAL()
|
* @see UDEBUG(), UINFO(), UWARN(), UERROR(), UFATAL()
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class ULogger
|
class FINDOBJECT_EXP ULogger
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -23,7 +23,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include "utilite/UWin32.h"
|
#include "find_object/utilite/UWin32.h"
|
||||||
#else
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
@ -9,8 +9,6 @@
|
|||||||
#ifndef _U_Win32_
|
#ifndef _U_Win32_
|
||||||
#define _U_Win32_
|
#define _U_Win32_
|
||||||
|
|
||||||
#include "utilite/UtiLiteExp.h"
|
|
||||||
|
|
||||||
#if !defined(_WINDOWS_)
|
#if !defined(_WINDOWS_)
|
||||||
// WIN32 Excludes
|
// WIN32 Excludes
|
||||||
#ifdef WIN32_LEAN_AND_MEAN
|
#ifdef WIN32_LEAN_AND_MEAN
|
||||||
@ -2,15 +2,16 @@
|
|||||||
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "find_object/Camera.h"
|
||||||
|
#include "find_object/Settings.h"
|
||||||
|
#include "find_object/utilite/ULogger.h"
|
||||||
|
#include "find_object/ObjWidget.h"
|
||||||
|
#include "find_object/QtOpenCV.h"
|
||||||
|
|
||||||
#include "AddObjectDialog.h"
|
#include "AddObjectDialog.h"
|
||||||
#include "ui_addObjectDialog.h"
|
#include "ui_addObjectDialog.h"
|
||||||
#include "ObjWidget.h"
|
|
||||||
#include "KeypointItem.h"
|
#include "KeypointItem.h"
|
||||||
#include "Camera.h"
|
|
||||||
#include "QtOpenCV.h"
|
|
||||||
#include "Settings.h"
|
|
||||||
#include "ObjSignature.h"
|
#include "ObjSignature.h"
|
||||||
#include "utilite/ULogger.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|||||||
95
src/CMakeLists.txt
Normal file
95
src/CMakeLists.txt
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
|
||||||
|
|
||||||
|
### Qt Gui stuff ###
|
||||||
|
SET(headers_ui
|
||||||
|
../include/${PROJECT_PREFIX}/MainWindow.h
|
||||||
|
../include/${PROJECT_PREFIX}/FindObject.h
|
||||||
|
../include/${PROJECT_PREFIX}/Camera.h
|
||||||
|
../include/${PROJECT_PREFIX}/TcpServer.h
|
||||||
|
../include/${PROJECT_PREFIX}/ObjWidget.h
|
||||||
|
./AddObjectDialog.h
|
||||||
|
./CameraTcpClient.h
|
||||||
|
./ParametersToolBox.h
|
||||||
|
./AboutDialog.h
|
||||||
|
./RectItem.h
|
||||||
|
./rtabmap/PdfPlot.h
|
||||||
|
./utilite/UPlot.h
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(uis
|
||||||
|
./ui/mainWindow.ui
|
||||||
|
./ui/addObjectDialog.ui
|
||||||
|
./ui/aboutDialog.ui
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(qrc
|
||||||
|
./resources.qrc
|
||||||
|
)
|
||||||
|
|
||||||
|
# generate rules for building source files from the resources
|
||||||
|
QT4_ADD_RESOURCES(srcs_qrc ${qrc})
|
||||||
|
|
||||||
|
#Generate .h files from the .ui files
|
||||||
|
QT4_WRAP_UI(moc_uis ${uis})
|
||||||
|
|
||||||
|
#This will generate moc_* for Qt
|
||||||
|
QT4_WRAP_CPP(moc_srcs ${headers_ui})
|
||||||
|
### Qt Gui stuff end###
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SET(SRC_FILES
|
||||||
|
./MainWindow.cpp
|
||||||
|
./AddObjectDialog.cpp
|
||||||
|
./KeypointItem.cpp
|
||||||
|
./RectItem.cpp
|
||||||
|
./QtOpenCV.cpp
|
||||||
|
./Camera.cpp
|
||||||
|
./CameraTcpClient.cpp
|
||||||
|
./ParametersToolBox.cpp
|
||||||
|
./Settings.cpp
|
||||||
|
./ObjWidget.cpp
|
||||||
|
./FindObject.cpp
|
||||||
|
./AboutDialog.cpp
|
||||||
|
./TcpServer.cpp
|
||||||
|
./Vocabulary.cpp
|
||||||
|
./utilite/ULogger.cpp
|
||||||
|
./utilite/UPlot.cpp
|
||||||
|
./utilite/UDirectory.cpp
|
||||||
|
./utilite/UFile.cpp
|
||||||
|
./utilite/UConversion.cpp
|
||||||
|
./rtabmap/PdfPlot.cpp
|
||||||
|
${moc_srcs}
|
||||||
|
${moc_uis}
|
||||||
|
${srcs_qrc}
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(INCLUDE_DIRS
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${OpenCV_INCLUDE_DIRS}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR} # for qt ui generated in binary dir
|
||||||
|
)
|
||||||
|
|
||||||
|
INCLUDE(${QT_USE_FILE})
|
||||||
|
|
||||||
|
SET(LIBRARIES
|
||||||
|
${QT_LIBRARIES}
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
)
|
||||||
|
|
||||||
|
#include files
|
||||||
|
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||||
|
|
||||||
|
# create a library from the source files
|
||||||
|
ADD_LIBRARY(find_object ${SRC_FILES})
|
||||||
|
# Linking with Qt libraries
|
||||||
|
TARGET_LINK_LIBRARIES(find_object ${LIBRARIES})
|
||||||
|
|
||||||
|
INSTALL(TARGETS find_object
|
||||||
|
RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT runtime
|
||||||
|
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT devel
|
||||||
|
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" COMPONENT devel)
|
||||||
|
|
||||||
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../include/ DESTINATION "${INSTALL_INCLUDE_DIR}" COMPONENT devel FILES_MATCHING PATTERN "*.h" PATTERN ".svn" EXCLUDE)
|
||||||
@ -2,18 +2,21 @@
|
|||||||
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Camera.h"
|
#include "find_object/Camera.h"
|
||||||
|
#include "find_object/Settings.h"
|
||||||
|
#include "find_object/utilite/ULogger.h"
|
||||||
|
#include "find_object/QtOpenCV.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <opencv2/imgproc/imgproc.hpp>
|
#include <opencv2/imgproc/imgproc.hpp>
|
||||||
#include "Settings.h"
|
|
||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
#include "utilite/UDirectory.h"
|
#include "utilite/UDirectory.h"
|
||||||
#include "utilite/ULogger.h"
|
#include "CameraTcpClient.h"
|
||||||
#include "QtOpenCV.h"
|
|
||||||
|
|
||||||
Camera::Camera(QObject * parent) :
|
Camera::Camera(QObject * parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
currentImageIndex_(0)
|
currentImageIndex_(0),
|
||||||
|
cameraTcpClient_(new CameraTcpClient(this))
|
||||||
{
|
{
|
||||||
qRegisterMetaType<cv::Mat>("cv::Mat");
|
qRegisterMetaType<cv::Mat>("cv::Mat");
|
||||||
connect(&cameraTimer_, SIGNAL(timeout()), this, SLOT(takeImage()));
|
connect(&cameraTimer_, SIGNAL(timeout()), this, SLOT(takeImage()));
|
||||||
@ -30,7 +33,7 @@ void Camera::stop()
|
|||||||
capture_.release();
|
capture_.release();
|
||||||
images_.clear();
|
images_.clear();
|
||||||
currentImageIndex_ = 0;
|
currentImageIndex_ = 0;
|
||||||
cameraTcpClient_.close();
|
cameraTcpClient_->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::pause()
|
void Camera::pause()
|
||||||
@ -92,24 +95,24 @@ void Camera::takeImage()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
img = cameraTcpClient_.getImage();
|
img = cameraTcpClient_->getImage();
|
||||||
if(cameraTcpClient_.imagesBuffered() > 0 && Settings::getCamera_9queueSize() == 0)
|
if(cameraTcpClient_->imagesBuffered() > 0 && Settings::getCamera_9queueSize() == 0)
|
||||||
{
|
{
|
||||||
UWARN("%d images buffered so far...", cameraTcpClient_.imagesBuffered());
|
UWARN("%d images buffered so far...", cameraTcpClient_->imagesBuffered());
|
||||||
}
|
}
|
||||||
while(img.empty() && cameraTcpClient_.waitForReadyRead())
|
while(img.empty() && cameraTcpClient_->waitForReadyRead())
|
||||||
{
|
{
|
||||||
img = cameraTcpClient_.getImage();
|
img = cameraTcpClient_->getImage();
|
||||||
}
|
}
|
||||||
if(img.empty())
|
if(img.empty())
|
||||||
{
|
{
|
||||||
if(!cameraTcpClient_.waitForConnected())
|
if(!cameraTcpClient_->waitForConnected())
|
||||||
{
|
{
|
||||||
UWARN("Connection is lost, trying to reconnect to server (%s:%d)... (at the rate of the camera: %d ms)",
|
UWARN("Connection is lost, trying to reconnect to server (%s:%d)... (at the rate of the camera: %d ms)",
|
||||||
Settings::getCamera_7IP().toStdString().c_str(),
|
Settings::getCamera_7IP().toStdString().c_str(),
|
||||||
Settings::getCamera_8port(),
|
Settings::getCamera_8port(),
|
||||||
cameraTimer_.interval());
|
cameraTimer_.interval());
|
||||||
cameraTcpClient_.connectToHost(Settings::getCamera_7IP(), Settings::getCamera_8port());
|
cameraTcpClient_->connectToHost(Settings::getCamera_7IP(), Settings::getCamera_8port());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,17 +146,17 @@ void Camera::takeImage()
|
|||||||
|
|
||||||
bool Camera::start()
|
bool Camera::start()
|
||||||
{
|
{
|
||||||
if(!capture_.isOpened() && images_.empty() && !cameraTcpClient_.isOpen())
|
if(!capture_.isOpened() && images_.empty() && !cameraTcpClient_->isOpen())
|
||||||
{
|
{
|
||||||
if(Settings::getCamera_6useTcpCamera())
|
if(Settings::getCamera_6useTcpCamera())
|
||||||
{
|
{
|
||||||
cameraTcpClient_.connectToHost(Settings::getCamera_7IP(), Settings::getCamera_8port());
|
cameraTcpClient_->connectToHost(Settings::getCamera_7IP(), Settings::getCamera_8port());
|
||||||
if(!cameraTcpClient_.waitForConnected())
|
if(!cameraTcpClient_->waitForConnected())
|
||||||
{
|
{
|
||||||
UWARN("Camera: Cannot connect to server \"%s:%d\"",
|
UWARN("Camera: Cannot connect to server \"%s:%d\"",
|
||||||
Settings::getCamera_7IP().toStdString().c_str(),
|
Settings::getCamera_7IP().toStdString().c_str(),
|
||||||
Settings::getCamera_8port());
|
Settings::getCamera_8port());
|
||||||
cameraTcpClient_.close();
|
cameraTcpClient_->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -212,7 +215,7 @@ bool Camera::start()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!capture_.isOpened() && images_.empty() && !cameraTcpClient_.isOpen())
|
if(!capture_.isOpened() && images_.empty() && !cameraTcpClient_->isOpen())
|
||||||
{
|
{
|
||||||
UERROR("Camera: Failed to open a capture object!");
|
UERROR("Camera: Failed to open a capture object!");
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -5,9 +5,10 @@
|
|||||||
* Author: mathieu
|
* Author: mathieu
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "find_object/Settings.h"
|
||||||
|
#include "find_object/utilite/ULogger.h"
|
||||||
|
|
||||||
#include "CameraTcpClient.h"
|
#include "CameraTcpClient.h"
|
||||||
#include "Settings.h"
|
|
||||||
#include "utilite/ULogger.h"
|
|
||||||
|
|
||||||
CameraTcpClient::CameraTcpClient(QObject *parent) :
|
CameraTcpClient::CameraTcpClient(QObject *parent) :
|
||||||
QTcpSocket(parent),
|
QTcpSocket(parent),
|
||||||
|
|||||||
@ -5,11 +5,12 @@
|
|||||||
* Author: mathieu
|
* Author: mathieu
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "FindObject.h"
|
#include "find_object/FindObject.h"
|
||||||
|
#include "find_object/Settings.h"
|
||||||
|
#include "find_object/utilite/ULogger.h"
|
||||||
|
|
||||||
#include "ObjSignature.h"
|
#include "ObjSignature.h"
|
||||||
#include "Settings.h"
|
|
||||||
#include "utilite/UDirectory.h"
|
#include "utilite/UDirectory.h"
|
||||||
#include "utilite/ULogger.h"
|
|
||||||
#include "Vocabulary.h"
|
#include "Vocabulary.h"
|
||||||
|
|
||||||
#include <QtCore/QThread>
|
#include <QtCore/QThread>
|
||||||
|
|||||||
@ -2,21 +2,23 @@
|
|||||||
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "MainWindow.h"
|
#include "find_object/MainWindow.h"
|
||||||
|
#include "find_object/Camera.h"
|
||||||
|
#include "find_object/Settings.h"
|
||||||
|
#include "find_object/TcpServer.h"
|
||||||
|
#include "find_object/FindObject.h"
|
||||||
|
#include "find_object/utilite/ULogger.h"
|
||||||
|
#include "find_object/ObjWidget.h"
|
||||||
|
#include "find_object/QtOpenCV.h"
|
||||||
|
|
||||||
#include "AddObjectDialog.h"
|
#include "AddObjectDialog.h"
|
||||||
#include "ui_mainWindow.h"
|
#include "ui_mainWindow.h"
|
||||||
#include "QtOpenCV.h"
|
|
||||||
#include "KeypointItem.h"
|
#include "KeypointItem.h"
|
||||||
#include "RectItem.h"
|
#include "RectItem.h"
|
||||||
#include "ObjWidget.h"
|
|
||||||
#include "Camera.h"
|
|
||||||
#include "Settings.h"
|
|
||||||
#include "ParametersToolBox.h"
|
#include "ParametersToolBox.h"
|
||||||
#include "AboutDialog.h"
|
#include "AboutDialog.h"
|
||||||
#include "TcpServer.h"
|
|
||||||
#include "rtabmap/PdfPlot.h"
|
#include "rtabmap/PdfPlot.h"
|
||||||
#include "Vocabulary.h"
|
#include "Vocabulary.h"
|
||||||
#include "FindObject.h"
|
|
||||||
#include "ObjSignature.h"
|
#include "ObjSignature.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -44,7 +46,6 @@
|
|||||||
#include <QtGui/QInputDialog>
|
#include <QtGui/QInputDialog>
|
||||||
|
|
||||||
#include "utilite/UDirectory.h"
|
#include "utilite/UDirectory.h"
|
||||||
#include "utilite/ULogger.h"
|
|
||||||
|
|
||||||
// Camera ownership transferred
|
// Camera ownership transferred
|
||||||
MainWindow::MainWindow(FindObject * findObject, Camera * camera, QWidget * parent) :
|
MainWindow::MainWindow(FindObject * findObject, Camera * camera, QWidget * parent) :
|
||||||
|
|||||||
@ -2,11 +2,12 @@
|
|||||||
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ObjWidget.h"
|
#include "find_object/Settings.h"
|
||||||
|
#include "find_object/utilite/ULogger.h"
|
||||||
|
#include "find_object/ObjWidget.h"
|
||||||
|
#include "find_object/QtOpenCV.h"
|
||||||
|
|
||||||
#include "KeypointItem.h"
|
#include "KeypointItem.h"
|
||||||
#include "QtOpenCV.h"
|
|
||||||
#include "Settings.h"
|
|
||||||
#include "utilite/ULogger.h"
|
|
||||||
|
|
||||||
#include <opencv2/highgui/highgui.hpp>
|
#include <opencv2/highgui/highgui.hpp>
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,9 @@
|
|||||||
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "find_object/Settings.h"
|
||||||
|
|
||||||
#include "ParametersToolBox.h"
|
#include "ParametersToolBox.h"
|
||||||
#include "Settings.h"
|
|
||||||
#include <QtGui/QComboBox>
|
#include <QtGui/QComboBox>
|
||||||
#include <QtGui/QDoubleSpinBox>
|
#include <QtGui/QDoubleSpinBox>
|
||||||
#include <QtGui/QLineEdit>
|
#include <QtGui/QLineEdit>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "QtOpenCV.h"
|
#include "find_object/QtOpenCV.h"
|
||||||
#include <opencv2/core/core_c.h>
|
#include <opencv2/core/core_c.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|||||||
@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef QTOPENCV_H
|
|
||||||
#define QTOPENCV_H
|
|
||||||
|
|
||||||
#include <QtGui/QImage>
|
|
||||||
#include <opencv2/core/core.hpp>
|
|
||||||
|
|
||||||
// Convert OpenCV matrix to QImage
|
|
||||||
QImage cvtCvMat2QImage(const cv::Mat & image, bool isBgr = true);
|
|
||||||
|
|
||||||
// Convert QImage to OpenCV matrix
|
|
||||||
cv::Mat cvtQImage2CvMat(const QImage & image);
|
|
||||||
|
|
||||||
// Convert IplImage to QImage
|
|
||||||
QImage cvtIplImage2QImage(const IplImage * image);
|
|
||||||
|
|
||||||
// Convert QImage to IplImage
|
|
||||||
IplImage * cvtQImage2IplImage(const QImage & image);
|
|
||||||
|
|
||||||
#endif // QTOPENCV_H
|
|
||||||
@ -2,9 +2,10 @@
|
|||||||
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
* Copyright (C) 2011, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Settings.h"
|
#include "find_object/Camera.h"
|
||||||
#include "Camera.h"
|
#include "find_object/Settings.h"
|
||||||
#include "utilite/ULogger.h"
|
#include "find_object/utilite/ULogger.h"
|
||||||
|
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
* Author: mathieu
|
* Author: mathieu
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "TcpServer.h"
|
#include "find_object/TcpServer.h"
|
||||||
#include "utilite/ULogger.h"
|
#include "find_object/utilite/ULogger.h"
|
||||||
|
|
||||||
#include <QtNetwork/QNetworkInterface>
|
#include <QtNetwork/QNetworkInterface>
|
||||||
#include <QtNetwork/QTcpSocket>
|
#include <QtNetwork/QTcpSocket>
|
||||||
|
|||||||
@ -5,8 +5,9 @@
|
|||||||
* Author: mathieu
|
* Author: mathieu
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "find_object/Settings.h"
|
||||||
|
|
||||||
#include "Vocabulary.h"
|
#include "Vocabulary.h"
|
||||||
#include "Settings.h"
|
|
||||||
#include <QtCore/QVector>
|
#include <QtCore/QVector>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|||||||
@ -100,7 +100,7 @@
|
|||||||
<customwidget>
|
<customwidget>
|
||||||
<class>ObjWidget</class>
|
<class>ObjWidget</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header>ObjWidget.h</header>
|
<header>find_object/ObjWidget.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
|
|||||||
@ -775,7 +775,7 @@
|
|||||||
<customwidget>
|
<customwidget>
|
||||||
<class>ObjWidget</class>
|
<class>ObjWidget</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header>ObjWidget.h</header>
|
<header>find_object/ObjWidget.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|||||||
@ -17,7 +17,8 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "utilite/ULogger.h"
|
#include "find_object/utilite/ULogger.h"
|
||||||
|
|
||||||
#include "utilite/UConversion.h"
|
#include "utilite/UConversion.h"
|
||||||
#include "utilite/UFile.h"
|
#include "utilite/UFile.h"
|
||||||
#include "utilite/UStl.h"
|
#include "utilite/UStl.h"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user