我正在使用 appsrc 测试视频流。根据我使用的测试图像的大小,似乎存在诱发失真。如果我使用 1024 x 768 图像,则不会出现失真。如果我使用 659 x 494 图像,则会出现如所附屏幕截图所示的失真现象。文本变得倾斜、翻译和换行。
// g++ gstreamer_test.cpp `pkg-config --cflags gstreamer-1.0` `pkg-config --libs gstreamer-1.0` -lopencv_core -lopencv_imgproc -lopencv_highgui
#include <gst/gst.h>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <cstddef>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cerrno>
cv::Mat openCvImage;
int width;
int height;
struct gstreamer_data {
GstElement* video_source;
GstElement* video_convert;
GstElement* video_sink;
GstElement* pipeline;
GMainLoop* main_loop;
guint source_id;
};
static gboolean push_data(gstreamer_data* data) {
GstBuffer* buffer;
GstMemory* memory;
GstMapInfo info;
GstFlowReturn ret;
gint size;
size = …Run Code Online (Sandbox Code Playgroud)