VSourceOpenCv C++ library v1.0.0
Low-latency video capture C++ library based on OpenCv. Provides simple interface for easy integration in C++ projects.
Overview
VSourceOpenCv C++ library serves as an OpenCV wrapper for the VSource class. It provides an interface for handling video sources using the cv::VideoCapture instance. VSourceOpenCv supports VSourceCommands and most of the VSourceParams. Additionally, it incorporates logging capabilities from the Logger library, enabling efficient monitoring and debugging. VSourceOpenCv class dependency: VSource library provides standard interface as well defines data structures and rules for different video source classes. library provides logging functions: printing in terminal and(or) printing in file. Library interface:
class VSourceOpenCv : public VSource { public: /// Open video source. bool openVSource(std::string& initString); /// Init video source by params structure. bool initVSource(VSourceParams& params); /// Get open status. bool isVSourceOpen(); /// Close video source. void closeVSource(); /// Get new video frame. bool getFrame(Frame& frame, int32_t timeoutMsec = 0); /// Set video source param. bool setParam(VSourceParam id, float value); /// Get video source param value. float getParam(VSourceParam id); /// Get video source params structure. VSourceParams getParams(); /// Execute command. bool executeCommand(VSourceCommand id); };
How to use
Below is a simple example of the program. The program opens the first video device in the system and captures video frames in an infinite loop.
#include <iostream> #include "VSourceOpenCv.h" int main(void) { // Open video device. cr::video::VSource* source = new cr::video::VSourceOpenCv(); if (!source->openVSource("test.mp4")) return -1; // Init frame. cr::video::Frame frame; // Main loop. while (true) { // Wait new frame 1000 msec. if (!source->getFrame(frame, 1000)) continue; // Show info about frame. std::cout << "New frame " << frame.frameId << " (" << frame.width << "x" << frame.height << ") cycle time: " << (int)source->getParam(cr::video::VSourceParam::CYCLE_TIME_MKS) << " mksec" << std::endl; } return 1; }
Downloads
VSourceOpenCv C++ library programmer’s manual: DOWNLOAD
Price and Terms
The VSourceOpenCv C++ library is supplied under a license in source code. Library pricing is available upon request info@constantrobotics.com.