This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <opencv2/opencv.hpp> | |
int main( int argc, char ** argv ) | |
{ | |
cv::VideoCapture cap; | |
cv::Mat frame; | |
const std::string windowName{ "RTP Stream" }; | |
cap.open( 0 ); | |
cap.set( cv::CAP_PROP_FRAME_WIDTH, 640 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <opencv2/opencv.hpp> | |
int main( int argc, char ** argv ) | |
{ | |
cv::VideoCapture cap; | |
cv::Mat frame; | |
const std::string windowName{ "RTP Capture" }; | |
cap.open( "udpsrc port=5000 caps = \"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96\" ! rtph264depay ! decodebin ! videoconvert ! appsink", cv::CAP_GSTREAMER ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <opencv2/opencv.hpp> | |
std::vector<cv::Mat> splitImage( cv::Mat & image, int M, int N ) | |
{ | |
// All images should be the same size ... | |
int width = image.cols / M; | |
int height = image.rows / N; | |
// ... except for the Mth column and the Nth row | |
int width_last_column = width + ( image.cols % width ); | |
int height_last_row = height + ( image.rows % height ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <opencv2/opencv.hpp> | |
cv::Mat imageCollage( std::vector<cv::Mat> & array_of_images, int M, int N ) | |
{ | |
// All images should be the same size | |
const cv::Size images_size = array_of_images[0].size(); | |
// Create a black canvas | |
cv::Mat image_collage( images_size.height * N, images_size.width * M, CV_8UC3, cv::Scalar( 0, 0, 0 ) ); | |
for( int i = 0; i < N; ++i ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef CIRCULAR_BUFFER_H | |
#define CIRCULAR_BUFFER_H | |
#include <array> | |
// Array-based push-only circular buffer. | |
// Sample usage: | |
// | |
// CircularBuffer<int, 3> buff; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <opencv2/opencv.hpp> | |
#include <opencv2/core/ocl.hpp> | |
int main( int argc, char ** argv ) | |
{ | |
cv::VideoCapture cap; | |
cv::Mat frame; | |
constexpr int FILTER_SIZE = 3; | |
const std::string windowName{ "Filter image" }; |