কম্পিউটার

কিভাবে C++ ব্যবহার করে OpenCV-তে অতিবাহিত সময় গণনা করবেন?


এখানে, আমরা বুঝব কিভাবে OpenCV ব্যবহার করে অতিবাহিত সময় গণনা করা যায়।

নিম্নলিখিত প্রোগ্রামটি C++ ব্যবহার করে ওপেনসিভিতে অতিবাহিত সময় গণনা করে।

উদাহরণ

#include<opencv2/opencv.hpp>//OpenCV header to use VideoCapture class//
#include<iostream>
using namespace std;
using namespace cv;
int main() {
   Mat myImage;//Declaring a matrix to load the frames//
   namedWindow("Video Player");//Declaring the video to show the video//
   VideoCapture cap("video.mp4");//Declaring an object to load video from device//
   if (!cap.isOpened()){ //This section prompt an error message if no video stream is found//
      cout << "No video stream detected" << endl;
      system("pause");
      return-1;
   }
   while (true){ //Taking an everlasting loop to show the video//
      cap >> myImage;
      int elapsed_time;//Declaring an integer variable to store the elapsed time//
      elapsed_time=cap.get(CAP_PROP_POS_MSEC);//Reading the elapsed time//
      cout << "Ellapsed time(in second):" << elapsed_time / 1000 << endl;//Showing the elapsed time in seconds//
      if (myImage.empty()){ //Breaking the loop if no video frame is detected//
         break;
      }
      imshow("Video Player", myImage);//Showing the video//
      char c = (char)waitKey(25);//Allowing 25 milliseconds frame processing time and initiating break condition//
      if (c == 27){ //If 'Esc' is entered break the loop//
         break;
      }
   }
   cap.release();//Releasing the buffer memory//
   return 0;
}

এই প্রোগ্রামটি ভিডিও চালাবে এবং কনসোল উইন্ডোতে অতিবাহিত সময় দেখাবে।

আউটপুট


কিভাবে C++ ব্যবহার করে OpenCV-তে অতিবাহিত সময় গণনা করবেন? কিভাবে C++ ব্যবহার করে OpenCV-তে অতিবাহিত সময় গণনা করবেন?


  1. কিভাবে C++ ব্যবহার করে OpenCV-এ একটি লাইন আঁকবেন?

  2. কিভাবে C++ ব্যবহার করে OpenCV তে একটি বাইনারি ইমেজ উল্টাতে হয়?

  3. কিভাবে C++ ব্যবহার করে OpenCV তে বাইনারি ইমেজ তৈরি করবেন?

  4. C++ ব্যবহার করে ওপেনসিভিতে একটি ছবির চ্যানেলের সংখ্যা কীভাবে গণনা করা যায়?