আমরা শিখব কিভাবে OpenCV-এ মোট ফ্রেমের সংখ্যা গণনা করা যায়। OpenCV ব্যবহার করে, একটি ভিডিওর মোট ফ্রেমের সংখ্যা গণনা করা এবং দেখানো প্রাথমিক। যাইহোক, আপনাকে একটি জিনিস মনে রাখতে হবে যে আমরা রিয়েল-টাইম ভিডিও ফ্রেমের মোট সংখ্যা গণনা করতে পারি না। কারণ একটি রিয়েল-টাইম ভিডিওতে নির্দিষ্ট সংখ্যক ফ্রেম থাকে না।
নিম্নলিখিত প্রোগ্রামটি মোট ফ্রেমের সংখ্যা গণনা করে এবং এটি কনসোল উইন্ডোতে দেখায়৷
উদাহরণ
#include<opencv2/opencv.hpp> #include<iostream> using namespace std; using namespace cv; int main() { int frame_Number;//Declaring an integervariable to store the number of total frames// VideoCapture cap("video.mp4");//Declaring an object to capture stream of frames from default camera// frame_Number = cap.get(CAP_PROP_FRAME_COUNT);//Getting the total number of frames// cout << "Total Number of frames are:" << frame_Number << endl;//Showing the number in console window// system("pause");//Pausing the system to see the result// cap.release();//Releasing the buffer memory// return 0; }
আউটপুট হিসাবে, আমরা একটি পূর্ণসংখ্যা মান পাব।
আউটপুট