Add preprocessor definition for simulation

This commit is contained in:
Yohan Simard 2021-03-02 18:39:32 +01:00
parent 188683847a
commit 1bdadaa50f
3 changed files with 33 additions and 34 deletions

View file

@ -1,6 +1,6 @@
build/ build/
src.sav/ src.sav/
cmake-build-debug/ cmake-build-*/
futur/ futur/
CMakeFiles/ CMakeFiles/

View file

@ -27,6 +27,7 @@ add_library(lib
) )
target_include_directories(lib PUBLIC lib) target_include_directories(lib PUBLIC lib)
target_link_libraries(lib base64) target_link_libraries(lib base64)
target_compile_definitions(lib PUBLIC __FOR_PC__ __SIMULATION__ __WITH_ARUCO__)
# Compile main executable # Compile main executable
add_executable(main main.cpp tasks.cpp tasks.h) add_executable(main main.cpp tasks.cpp tasks.h)

View file

@ -22,8 +22,7 @@
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#ifndef __FOR_PC__ #ifndef __FOR_PC__
// TODO install raspicam and uncomment #include "raspicam/raspicam_cv.h"
//#include "raspicam/raspicam_cv.h"
#endif /* __FOR_PC__ */ #endif /* __FOR_PC__ */
#include "img.h" #include "img.h"
@ -82,38 +81,37 @@ public:
*/ */
bool IsOpen(); bool IsOpen();
/** /**
* Define size for sampled picture * Define size for sampled picture
* @param size Size of picture (@see captureSize) * @param size Size of picture (@see captureSize)
*/ */
void SetSize(int size); void SetSize(int size);
/** /**
* Grab next image from camera * Grab next image from camera
* @return Image taken from camera * @return Image taken from camera
*/ */
Img Grab(); Img Grab();
private: private:
// TODO install raspicam and uncomment #ifdef __FOR_PC__
//#ifdef __FOR_PC__ /**
// /** * Camera descriptor
// * Camera descriptor */
// */ cv::VideoCapture cap;
// cv::VideoCapture cap; #else
//#else raspicam::RaspiCam_Cv cap;
// raspicam::RaspiCam_Cv cap; #endif /* __FOR_PC__ */
//#endif /* __FOR_PC__ */
/** /**
* Size for image (default= small) * Size for image (default= small)
*/ */
int size = sm; int size = sm;
/** /**
* Width of image * Width of image
*/ */
int width; int width;
/** /**
* Height of image * Height of image