49 lines
848 B
C++

#include "input.h"
Input::Input(/* args */)
{
}
Input::~Input()
{
}
Mat Input::readFile(String filePath)
{
Mat image = imread(filePath, IMREAD_COLOR);
if(image.empty())
{
std::cout << "Could not read the image: " << filePath << std::endl;
return Mat();
//To do:Exception handeling
}
imshow("Display window", image);
waitKey(0);
return image;
}
Mat Input::readWebcam()
{
const int VID_HEIGHT = 240;
const int VID_WIDTH = 320;
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();
return Mat();
return Mat();
}
cap.read(image);
imshow("Display window", image);
waitKey(0);
return image;
}