Hello,
I’m a beginner in programming and bad at English. But I hope that you will help me with my problem.
I open a video in my program and play it in a window.
A video camera is also running, which I evaluate.
If I don’t want to play the video from the beginning, it stutters (activate **********).
Later I would like to repeat the last 3 seconds of the video during an action from the camera. Then I want to repeat the last three seconds again in slow motion.
I hope I have explained this clearly and you can help me.
(I use Rasbian on a Raspberry Pi 4b / 8Gb)
Many Thanks,
Achim
#include <iostream> #include <opencv2/opencv.hpp> #include "opencv2/highgui/highgui.hpp" using namespace cv; using namespace std; //int zaehler= 200; //****************************************** Begin at frame 200 int main() { VideoCapture capCam = VideoCapture(0); VideoCapture capVid = VideoCapture("SW-3.mpeg"); namedWindow("video", WINDOW_NORMAL); resizeWindow("video", 1300,700); moveWindow("video", 1950,0); while(waitKey(1) !='q') { Mat BildVid; Mat BildCam; Mat bgr[3]; double min_val, max_val; Point minLoc, maxLoc; //double scalar; capCam.read(BildCam); //capVid.set(1,zaehler);//**************************** //zaehler++;//********************************** capVid.read(BildVid); if(!BildCam.empty()) { split(BildCam, bgr); //imshow(image, bgr[2]); //cvtColor(image, gray, COLOR_BGR2GRAY); minMaxLoc( bgr[2], &min_val, &max_val, &minLoc, &maxLoc); if(max_val>250) { std::cout<<"maxLoc, maxVal = "<<maxLoc<<", "<<max_val<<std::endl; circle (BildVid, maxLoc, 5, Scalar(0, 0, 255), 3, LINE_AA); } imshow("video", BildVid); //imshow("camera", BildCam); } } }