find_package( OpenCV REQUIRED ) | find_package( OpenCV REQUIRED ) | ||||
include_directories( ${OpenCV_INCLUDE_DIRS} ) | include_directories( ${OpenCV_INCLUDE_DIRS} ) | ||||
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/Input ) | include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/Input ) | ||||
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/Processing) | |||||
link_directories( ${Input_SOURCE_DIRS} ) | link_directories( ${Input_SOURCE_DIRS} ) | ||||
link_directories( ${Processing_SOURCE_DIRS} ) | |||||
add_subdirectory(Input) | add_subdirectory(Input) | ||||
add_subdirectory(Processing) | |||||
target_include_directories(Input PRIVATE .) | target_include_directories(Input PRIVATE .) | ||||
add_executable(lfr_image_processing lfr.cpp) | |||||
target_include_directories(Processing PRIVATE .) | |||||
add_executable(lfr_image_processing lfr.cpp) | |||||
target_link_libraries( lfr_image_processing ${OpenCV_LIBS}) | target_link_libraries( lfr_image_processing ${OpenCV_LIBS}) | ||||
target_link_libraries( lfr_image_processing Input ) | target_link_libraries( lfr_image_processing Input ) | ||||
target_link_libraries( lfr_image_processing Processing ) | |||||
set(CPACK_PROJECT_NAME ${PROJECT_NAME}) | set(CPACK_PROJECT_NAME ${PROJECT_NAME}) | ||||
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) | set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) |
Mat Input::readWebcam() | Mat Input::readWebcam() | ||||
{ | { | ||||
const int VID_HEIGHT = 1232; | |||||
const int VID_WIDTH = 1640; | |||||
const int VID_HEIGHT = 240; | |||||
const int VID_WIDTH = 320; | |||||
Mat image; | Mat image; | ||||
VideoCapture cap(0); | VideoCapture cap(0); | ||||
if(!cap.isOpened()) { | if(!cap.isOpened()) { | ||||
cout << "Fehler"; | cout << "Fehler"; | ||||
return Mat(); | return Mat(); | ||||
return Mat(); | |||||
return Mat(); | |||||
} | } | ||||
cap.read(image); | cap.read(image); | ||||
imshow("Display window", image); | |||||
waitKey(0); | |||||
return image; | return image; | ||||
} | } |
find_package( OpenCV REQUIRED ) | |||||
include_directories( ${OpenCV_INCLUDE_DIRS} ) | |||||
add_library(Processing processing.cpp) | |||||
set_target_properties(Processing PROPERTIES VERSION ${PROJECT_VERSION}) | |||||
target_include_directories(Processing PRIVATE .) | |||||
target_link_libraries( Processing ${OpenCV_LIBS}) | |||||
set(CPACK_PROJECT_NAME ${PROJECT_NAME}) | |||||
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) | |||||
include(CPack) |
#include "processing.h" | |||||
processing::processing(/* args */) | |||||
{ | |||||
} | |||||
processing::~processing() | |||||
{ | |||||
} |
#include <iostream> | #include <iostream> | ||||
#include <opencv2/opencv.hpp> | #include <opencv2/opencv.hpp> | ||||
#include <input.h> | #include <input.h> | ||||
#include <processing.h> | |||||
using namespace cv; | using namespace cv; | ||||
{ | { | ||||
std::cout<<"Hello world"; | std::cout<<"Hello world"; | ||||
Input test; | Input test; | ||||
Mat image1 = test.readFile("C:\\Line-Following-Robot\\Test_data\\WhatsApp Image 2022-10-26 at 09.54.14.jpeg"); | |||||
// Mat image1 = test.readFile("C:\\Line-Following-Robot\\Test_data\\WhatsApp Image 2022-10-26 at 09.54.14.jpeg"); | |||||
Mat image2 = test.readWebcam(); | Mat image2 = test.readWebcam(); | ||||
} | } |