Webcam Bild auslesen am Laptop möglich
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
find_package( OpenCV REQUIRED )
|
||||
include_directories( ${OpenCV_INCLUDE_DIRS} )
|
||||
|
||||
|
||||
add_library(Input input.cpp)
|
||||
set_target_properties(Input PROPERTIES VERSION ${PROJECT_VERSION})
|
||||
target_include_directories(Input PRIVATE .)
|
||||
|
||||
+18
-2
@@ -1,5 +1,6 @@
|
||||
#include "input.h"
|
||||
|
||||
|
||||
Input::Input(/* args */)
|
||||
{
|
||||
}
|
||||
@@ -22,7 +23,22 @@ Mat Input::readFile(String filePath)
|
||||
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
@@ -12,7 +12,7 @@ public:
|
||||
Input(/* args */);
|
||||
~Input();
|
||||
Mat readFile(String filePath);
|
||||
void readWebcam();
|
||||
Mat readWebcam();
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user