This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728关于OPENCV 图像采集显示CPU占用太多的咨询

Other Parts Discussed in Thread: AM5728

你好,我在使用AM5728做图像采集显示实验,中间无任何复杂算法,但是使用TOP查看CPU占用率居然到了95%,图像卡顿严重,但是我使用gst-launch-1.0 的方法采集显示图像,CPU占用只有5%左右,图像也不卡顿,OPENCV代码如下:

#include<iostream>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/videoio/videoio.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace std;
using namespace cv;

Mat frame;

namespace{

int process(VideoCapture& capture) {
namedWindow("Video", WINDOW_NORMAL|WINDOW_FREERATIO);
resizeWindow("Video", 1280, 720);

while(1) {
capture >> frame;
if (frame.empty())
break;

imshow("Video", frame);
char key = (char)waitKey(15);
switch (key) {
case 27: //escape key
return 0;
default:
break;
}
}
return 0;
}
}

int main()
{
VideoCapture capture(1);
if(!capture.isOpened()){
cerr << "open fail !\n" << endl;
return 1;
}

return process(capture);

}

CPU占用率如下图:

如果使用 gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=-1 io-mode=4 ! 'video/x-raw,format=(string)YUY2, width=(int)1920, height=(int)1080' ! vpe num-input-buffers=8 ! queue ! waylandsink

CPU占用率如下:

谁有遇到过类似情况,求解答,不胜感激