/**
* Opencv中一般是读取 demo.avi 格式视频,下面程序是直接读取 demo.yuv 然后使用 Mat 保存
* 再使用 cv::cvtColor() 将每帧的 yuv 数据转化为 rgb 然后显示
*/
#include <opencv/cv.h>
#include <fstream>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace std;
using namespace cv;
const int width = 1280;
const int height = 720;
const int framesize = width * height * 3 / 2; //一副图所含的像素个数
typedef struct planet
{
char name[framesize];
double population;
double g;
} PLANET;
int main()
{
/
// 计算视频的帧数,怎样替换成c语言形式的?
PLANET pl;
ifstream fin;
fin.open("demo.yuv", ios_base::in|ios_base::binary);
if(fin.fail())
{
cout << "the file is error" << endl;
return -1;
}
fin.seekg(0, ios::end); //设置文件指针到文件流的尾部
streampos ps = fin.tellg(); //指出当前的文件指针
unsigned lon