You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
4.4 KiB
118 lines
4.4 KiB
// This file is part of OpenCV project. |
|
// It is subject to the license terms in the LICENSE file found in the top-level directory |
|
// of this distribution and at http://opencv.org/license.html. |
|
// Copyright Amir Hassan (kallaballa) <amir@viel-zu.org> |
|
|
|
#ifndef SRC_COMMON_UTIL_HPP_ |
|
#define SRC_COMMON_UTIL_HPP_ |
|
|
|
#include "source.hpp" |
|
#include "sink.hpp" |
|
|
|
#include <string> |
|
#include <iostream> |
|
#include <opencv2/opencv.hpp> |
|
#include <opencv2/core/ocl.hpp> |
|
#ifdef __EMSCRIPTEN__ |
|
# include <emscripten.h> |
|
# include <emscripten/bind.h> |
|
# include <fstream> |
|
#endif |
|
|
|
namespace cv { |
|
namespace viz { |
|
using std::string; |
|
class Viz2D; |
|
/*! |
|
* Returns the OpenGL Version information. |
|
* @return a string object with the OpenGL version information |
|
*/ |
|
CV_EXPORTS std::string getGlInfo(); |
|
/*! |
|
* Returns the OpenCL Version information. |
|
* @return a string object with the OpenCL version information |
|
*/ |
|
CV_EXPORTS std::string getClInfo(); |
|
/*! |
|
* Determines if Intel VAAPI is supported |
|
* @return true if it is supported |
|
*/ |
|
CV_EXPORTS bool isIntelVaSupported(); |
|
/*! |
|
* Determines if cl_khr_gl_sharing is supported |
|
* @return true if it is supported |
|
*/ |
|
CV_EXPORTS bool isClGlSharingSupported(); |
|
/*! |
|
* Pretty prints system information. |
|
*/ |
|
CV_EXPORTS void printSystemInfo(); |
|
/*! |
|
* Tells the application if it's alright to keep on running. |
|
* Note: If you use this mechanism signal handlers are installed |
|
* using #install_signal_handlers() |
|
* @return true if the program should keep on running |
|
*/ |
|
CV_EXPORTS bool keepRunning(); |
|
|
|
/*! |
|
* Little helper function to keep track of FPS and optionally display it using NanoVG |
|
* @param v2d The Viz2D object to operate on |
|
* @param graphical if this parameter is true the FPS drawn on display |
|
*/ |
|
CV_EXPORTS void updateFps(cv::Ptr<Viz2D> viz2d, bool graphical); |
|
|
|
#ifndef __EMSCRIPTEN__ |
|
/*! |
|
* Creates an Intel VAAPI enabled VideoWriter sink object to use in conjunction with #Viz2D::setSink(). |
|
* Usually you would call #make_writer_sink() and let it automatically decide if VAAPI is available. |
|
* @param outputFilename The filename to write the video to. |
|
* @param fourcc The fourcc code of the codec to use. |
|
* @param fps The fps of the target video. |
|
* @param frameSize The frame size of the target video. |
|
* @param vaDeviceIndex The VAAPI device index to use. |
|
* @return A VAAPI enabled sink object. |
|
*/ |
|
CV_EXPORTS Sink makeVaSink(const string& outputFilename, const int fourcc, const float fps, |
|
const cv::Size& frameSize, const int vaDeviceIndex); |
|
/*! |
|
* Creates an Intel VAAPI enabled VideoCapture source object to use in conjunction with #Viz2D::setSource(). |
|
* Usually you would call #make_capture_source() and let it automatically decide if VAAPI is available. |
|
* @param inputFilename The file to read from. |
|
* @param vaDeviceIndex The VAAPI device index to use. |
|
* @return A VAAPI enabled source object. |
|
*/ |
|
CV_EXPORTS Source makeVaSource(const string& inputFilename, const int vaDeviceIndex); |
|
/*! |
|
* Creates a VideoWriter sink object to use in conjunction with #Viz2D::setSink(). |
|
* This function automatically determines if Intel VAAPI is available and enables it if so. |
|
* @param outputFilename The filename to write the video to. |
|
* @param fourcc The fourcc code of the codec to use. |
|
* @param fps The fps of the target video. |
|
* @param frameSize The frame size of the target video. |
|
* @return A (optionally VAAPI enabled) VideoWriter sink object. |
|
*/ |
|
CV_EXPORTS Sink makeWriterSink(const string& outputFilename, const int fourcc, const float fps, |
|
const cv::Size& frameSize); |
|
/*! |
|
* Creates a VideoCapture source object to use in conjunction with #Viz2D::setSource(). |
|
* This function automatically determines if Intel VAAPI is available and enables it if so. |
|
* @param inputFilename The file to read from. |
|
* @return A (optionally VAAPI enabled) VideoCapture enabled source object. |
|
*/ |
|
CV_EXPORTS Source makeCaptureSource(const string& inputFilename); |
|
#else |
|
/*! |
|
* Creates a WebCam source object to use in conjunction with #Viz2D::setSource(). |
|
* In the background it uses emscripten's file system implementation to transfer frames from the camera to the source object |
|
* @param width The frame width to capture (usually the initial width of the Viz2D object) |
|
* @param height The frame height to capture (usually the initial height of the Viz2D object) |
|
* @return A WebCam source object. |
|
*/ |
|
CV_EXPORTS Source makeCaptureSource(int width, int height); |
|
#endif |
|
|
|
} |
|
} |
|
|
|
#endif /* SRC_COMMON_UTIL_HPP_ */
|
|
|