mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-03 11:55:00 +00:00
added base OpenCV script and documentation
This commit is contained in:
8
docs/code/OpenCV.md
Normal file
8
docs/code/OpenCV.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# OpenCV
|
||||
|
||||
|
||||
|
||||
## Installation
|
||||
### Dependencies
|
||||
* glew
|
||||
* opencv
|
9
src/C++/OpenCV/CMakeLists.txt
Normal file
9
src/C++/OpenCV/CMakeLists.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
project( main )
|
||||
find_package( OpenCV REQUIRED )
|
||||
include_directories( ${OpenCV_INCLUDE_DIRS} )
|
||||
add_executable( main main.cpp )
|
||||
target_link_libraries( main ${OpenCV_LIBS} )
|
||||
|
||||
|
||||
#sauce: https://docs.opencv.org/4.x/db/df5/tutorial_linux_gcc_cmake.html
|
0
src/C++/OpenCV/OpenCV.cpp
Normal file
0
src/C++/OpenCV/OpenCV.cpp
Normal file
0
src/C++/OpenCV/OpenCV.hpp
Normal file
0
src/C++/OpenCV/OpenCV.hpp
Normal file
31
src/C++/OpenCV/main.cpp
Normal file
31
src/C++/OpenCV/main.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <opencv4/opencv2/core/core.hpp>
|
||||
#include <opencv4/opencv2/imgcodecs.hpp>
|
||||
#include <opencv4/opencv2/highgui/highgui.hpp>
|
||||
#include "opencv4/opencv2/imgproc/imgproc.hpp"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main() {
|
||||
Mat myImage; //Declaring a matrix to load the frames
|
||||
namedWindow("Video Player"); //Declaring the video to show the video//
|
||||
VideoCapture cap(0); //Declaring an object to capture stream of frames from default camera//
|
||||
if (!cap.isOpened()){ //This section prompt an error message if no video stream is found//
|
||||
cout << "No video stream detected" << endl;
|
||||
system("pause");
|
||||
return-1;
|
||||
}
|
||||
while (true){
|
||||
cap >> myImage; //
|
||||
if (myImage.empty()){ //Breaking the loop if no video frame is detected//
|
||||
break;
|
||||
}
|
||||
imshow("Video Player", myImage); //Showing the video//
|
||||
char c = (char)waitKey(25); //Allowing 25 milliseconds frame processing time and initiating break condition//
|
||||
}
|
||||
cap.release(); //Releasing the buffer memory//
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user