include<opencv2 opencv.hpp="">
#include <opencv2/calib3d.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2\videoio.hpp>
#include <opencv/highgui.h>
#include <opencv/cv.h>
#include <opencv2/core/utility.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <stdlib.h>
#include <iomanip>
#include <ctype.h>
#include <math.h>
#include <tchar.h>
#include <windows.h>
#include <vector>//
#include <thread>//
#include <concurrent_queue.h>//
using namespace std;
using namespace cv;
cv::Mat dst, cdst;
cv::Mat frame2, edges;
int main() {
VideoCapture cap2("rtsp://admin:[email protected]:554/h264/ch1/main/av_stream");
if (!cap2.isOpened()) {
std::cout << "Error opening video stream or file" << std::endl;
return -1;
}
else
{
std::cout << " la camara IP 2 se abrio con exito!" << std::endl;
cv::Mat frame;
}
//cv::VideoCapture vcap;
/*cv::VideoCapture cap2("rtsp://admin:[email protected]:554/h264/ch1/main/av_stream");
if (!cap2.isOpened()) {
std::cout << "Error opening video stream or file" << std::endl;
return -1;
}
else
{
std::cout << " la camara IP 2 se abrio con exito!" << std::endl;
cv::Mat frame;
}*/
int frame_width = cap2.get(CV_CAP_PROP_FRAME_WIDTH);
int frame_height = cap2.get(CV_CAP_PROP_FRAME_HEIGHT);
VideoWriter video("data .avi", CV_FOURCC('M', 'J', 'P', 'G'), 30, Size(frame_width, frame_height));//Almacenamos video en disco
for (;;) {
cap2 >> frame2;
/*if (!vcap.read(frame1)) {
//std::cout << "No frame" << std::endl;
cv::waitKey();
}*/
video.write(frame2);//GRABAMOS EL VIDEO
//video.write(frame1);//GRABAMOS EL VIDEO
/**cv::cvtColor(frame2, edges, CV_BGR2GRAY);
GaussianBlur(edges, edges, Size(5, 5), 1.5, 1.5);//aplicamos filtro gaussiano con la finalidad de eliminar el ruido
Canny(edges, edges, 0, 30, 3);//detectamos los bordes del entorno*/
cv::namedWindow("camera2");
cv::resizeWindow("camera2", 520, 520);//asignamos la ventana
imshow("camera2", frame2);
//imshow("image", edges);
if (cv::waitKey(1) >= 0) break;
}
return 0;
}