Using gstcameraundistort
itaidagan
itai at joymo.no
Mon Nov 11 13:04:01 UTC 2019
Helllo everyone,
I'm new to Gstreamer and I'm trying to write a simple pipeline that utilizes
gstcameraundistort
<https://github.com/GStreamer/gst-plugins-bad/blob/master/ext/opencv/gstcameraundistort.cpp>
. Unfortunately I'm unable to understand how to insert it into my pipeline,
beginning with the very basic ability of creating the element using
gst_element_factory_make.
Questions:
0. What do I need to include in my code to be able to create a
cameraundistort module?
1. How can I set the distortion parameters for the undistort module?
2. Given that I will be able to use the cameraundistort plugin, how can I
change the underlying source code?
I'm asking about the source code for two reasons, first, I would like for
the module to work without having a cameracalibrate element in the pipeline,
and secondly, because I would like to optimize the code to run with CUDA
(I'm running on a Jetson TX2).
Running apt list --installed | grep gstreamer I get:
gir1.2-gstreamer-1.0/bionic-updates,now 1.14.5-0ubuntu1~18.04.1 arm64
[installed,automatic]
gstreamer1.0-alsa/bionic-updates,now 1.14.5-0ubuntu1~18.04.1 arm64
[installed]
gstreamer1.0-clutter-3.0/bionic,now 3.0.26-1 arm64 [installed,automatic]
gstreamer1.0-gl/bionic-updates,now 1.14.5-0ubuntu1~18.04.1 arm64
[installed,automatic]
gstreamer1.0-gtk3/bionic-updates,now 1.14.5-0ubuntu1~18.04.1 arm64
[installed,automatic]
gstreamer1.0-libav/bionic-updates,now 1.14.5-0ubuntu1~18.04.1 arm64
[installed]
gstreamer1.0-packagekit/bionic-updates,now 1.1.9-1ubuntu2.18.04.5 arm64
[installed]
gstreamer1.0-plugins-bad/bionic-updates,now 1.14.5-0ubuntu1~18.04.1 arm64
[installed]
gstreamer1.0-plugins-base/bionic-updates,now 1.14.5-0ubuntu1~18.04.1 arm64
[installed]
gstreamer1.0-plugins-base-apps/bionic-updates,now 1.14.5-0ubuntu1~18.04.1
arm64 [installed,automatic]
gstreamer1.0-plugins-good/bionic-updates,now 1.14.5-0ubuntu1~18.04.1 arm64
[installed]
gstreamer1.0-plugins-ugly/bionic-updates,now 1.14.5-0ubuntu1~18.04.1 arm64
[installed]
gstreamer1.0-pulseaudio/bionic-updates,now 1.14.5-0ubuntu1~18.04.1 arm64
[installed,automatic]
gstreamer1.0-tools/bionic-updates,now 1.14.5-0ubuntu1~18.04.1 arm64
[installed]
gstreamer1.0-x/bionic-updates,now 1.14.5-0ubuntu1~18.04.1 arm64
[installed,automatic]
libgstreamer-gl1.0-0/bionic-updates,now 1.14.5-0ubuntu1~18.04.1 arm64
[installed,automatic]
libgstreamer-plugins-bad1.0-0/bionic-updates,now 1.14.5-0ubuntu1~18.04.1
arm64 [installed,automatic]
libgstreamer-plugins-base1.0-0/bionic-updates,now 1.14.5-0ubuntu1~18.04.1
arm64 [installed,automatic]
libgstreamer-plugins-base1.0-dev/bionic-updates,now 1.14.5-0ubuntu1~18.04.1
arm64 [installed]
libgstreamer-plugins-good1.0-0/bionic-updates,now 1.14.5-0ubuntu1~18.04.1
arm64 [installed,automatic]
libgstreamer1.0-0/bionic-updates,now 1.14.5-0ubuntu1~18.04.1 arm64
[installed,automatic]
libgstreamer1.0-dev/bionic-updates,now 1.14.5-0ubuntu1~18.04.1 arm64
[installed]
libreoffice-avmedia-backend-gstreamer/bionic-updates,bionic-security,now
1:6.0.7-0ubuntu0.18.04.10 arm64 [installed]
So it looks like I have gst-plugins-bad installed, I don't know why I can't
use the cameraundistort plugin.
Part of my code is attached below, it's based on one of the official
tutorials on the website:
#include <gst/gst.h>
/* Structure to contain all our information, so we can pass it to callbacks
*/
typedef struct _CustomData {
GstElement *pipeline;
GstElement *source;
GstElement *demux;
GstElement *parse;
GstElement *decoder;
GstElement *undistort;
GstElement *videoconvert;
GstElement *videosink;
} CustomData;
/* Handler for the pad-added signal */
static void pad_added_handler (GstElement *src, GstPad *pad, CustomData
*data);
int main(int argc, char *argv[]) {
CustomData data;
GstBus *bus;
GstMessage *msg;
GstStateChangeReturn ret;
gboolean terminate = FALSE;
/* Initialize GStreamer */
gst_init (&argc, &argv);
/* Create the elements */
data.source = gst_element_factory_make("filesrc", "source");
data.demux = gst_element_factory_make("matroskademux", "demux");
data.parse = gst_element_factory_make("h264parse", "parse");
data.decoder = gst_element_factory_make("omxh264dec", "decoder");
data.videoconvert = gst_element_factory_make("videoconvert",
"video_convert");
data.videosink = gst_element_factory_make("nveglglessink",
"video_sink");
data.undistort = gst_element_factory_make("cameraundistort",
"undistort");
//g_print("%s", data.undistort);
if (data.undistort == NULL){
g_print("Could not create undistort element.\n");
}
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list