Browse Source

Webcam Bild auslesen am Laptop möglich

pull/1/head
Baran Yasar 2 years ago
parent
commit
58b094f175
5 changed files with 22 additions and 7 deletions
  1. 0
    2
      CMakeLists.txt
  2. 1
    1
      Input/CMakeLists.txt
  3. 18
    2
      Input/input.cpp
  4. 1
    1
      Input/input.h
  5. 2
    1
      lfr.cpp

+ 0
- 2
CMakeLists.txt View File



add_subdirectory(Input) add_subdirectory(Input)
target_include_directories(Input PRIVATE .) target_include_directories(Input PRIVATE .)

add_executable(lfr_image_processing lfr.cpp) 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 )



set(CPACK_PROJECT_NAME ${PROJECT_NAME}) set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack) include(CPack)

+ 1
- 1
Input/CMakeLists.txt View File

find_package( OpenCV REQUIRED ) find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} ) include_directories( ${OpenCV_INCLUDE_DIRS} )
add_library(Input input.cpp) add_library(Input input.cpp)
set_target_properties(Input PROPERTIES VERSION ${PROJECT_VERSION}) set_target_properties(Input PROPERTIES VERSION ${PROJECT_VERSION})
target_include_directories(Input PRIVATE .) target_include_directories(Input PRIVATE .)

+ 18
- 2
Input/input.cpp View File

#include "input.h" #include "input.h"



Input::Input(/* args */) Input::Input(/* args */)
{ {
} }
return image; return image;
} }


void Input::readWebcam()
Mat Input::readWebcam()
{ {
//To do an Raspberry-Pi
const int VID_HEIGHT = 1232;
const int VID_WIDTH = 1640;
Mat image;
VideoCapture cap(0);

cap.set(CAP_PROP_FRAME_HEIGHT, VID_HEIGHT);
cap.set(CAP_PROP_FRAME_WIDTH, VID_WIDTH);

if(!cap.isOpened()) {
cout << "Fehler";
return Mat();
}

cap.read(image);

return image;
} }

+ 1
- 1
Input/input.h View File

Input(/* args */); Input(/* args */);
~Input(); ~Input();
Mat readFile(String filePath); Mat readFile(String filePath);
void readWebcam();
Mat readWebcam();
}; };





+ 2
- 1
lfr.cpp View File

{ {
std::cout<<"Hello world"; std::cout<<"Hello world";
Input test; Input test;
Mat image = 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();
} }

Loading…
Cancel
Save