RK3588 opencv读取视频速度慢

固件类型:官方提供的固件
固件文件名称:ROC-RK3588-PC_Ubuntu20.04-Gnome-r2407_v1.1.1a_2307
固件下载地址:百度网盘
Log日志:log.rar

我在RK3588上,用opencv读取和播放一个本地视频,发现用opencv读取帧数据耗时过长,每个帧基本上要0.28s左右,如下图所示:

然后我在笔记本电脑的ubuntu20.04虚拟机上执行了同样的代码,发现每个帧读取时间要少很多,大致在0.025s,如下图:

请问我如何解决这个问题?谢谢各位~

附:main.cpp源码

#include <opencv2/opencv.hpp>
#include
#include <time.h>
using namespace cv;
using namespace std;

int main()
{
clock_t start, end;
clock_t t1, t2, t3, t4;

double open_time, grab_time, read_time, show_time;

namedWindow("example", WINDOW_AUTOSIZE);

Mat mframe;
VideoCapture vcapture;

start = clock();
bool openResult = vcapture.open("/home/zhuzhikai/QT_Programming/sample.mp4");
if (!openResult)
{
    cout << "The video cannot be opened!" << endl;
}
end = clock();
open_time = (double)(end-start)/CLOCKS_PER_SEC;
cout << "open_time = " << open_time << " ms " << endl;

int num = 0;

t1 = clock();

while (vcapture.grab())
{
    t2 = clock();
    grab_time = (double)(t2-t1)/CLOCKS_PER_SEC;

    vcapture >> mframe;

    t3 = clock();
    read_time = (double)(t3-t2)/CLOCKS_PER_SEC;

    if (mframe.size().width > 0 || mframe.size().height > 0)
    {
        imshow("example", mframe);
    }
    else
    {
        break;
    }

    if (waitKey(10) >= 0)
    {
        break;
    }

    t4 = clock();
    show_time = (double)(t4-t3)/CLOCKS_PER_SEC;

    cout << "Frame " << num << "  :   "
         << "grab_time = " << grab_time << " ms , "
         << "read_time = " << read_time << " ms , "
         << "show_time = " << show_time << " ms" << endl;
    num++;

    t1 = clock();
}

cout << "frame number = " << num << endl;

return 0;

}

tchip_askquestions
log.rar (605 KB)

你好,大佬,请问你解决了吗?

opencv在这种板子上解码能力不够吧