Quantcast

From UVC jpeg webcam to OpenCV using Gstreamer

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

From UVC jpeg webcam to OpenCV using Gstreamer

Damien Picard
Hi,

Due to an issue in opencv4tegra, I can not capture from my UVC webcam using OpenCV. To get round this problem, I'm trying to use GStreamer and its Python bindings to capture jpeg images from the webcam.

To do that, I adapt this tutorial with a custom pipeline.
Currently my pipeline looks like this :

v4l2src ! image/jpeg,width=1920,height=1080 ! jpegdec ! videoconvert ! appsink name=sink caps=video/x-raw, format=(string){BGR, GRAY8}; video/x-bayer,format=(string){rggb,bggr,grbg,gbrg}

(The function that convert gstreamer to opencv array is exactly the same as in the tutorial)

It works (maybe the colors are not the good ones, but I'm not sure), but I'm wondering if there is a way to retrieve the jpeg images directly from gstreamer ? By this way, I will decode them using OpenCV and I hope that it could, at least, limits processing.

Thank you in advance.

--
Damien Picard
Expert GWT
Mob : 06 11 51 47 78

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: From UVC jpeg webcam to OpenCV using Gstreamer

Thiago Sousa Santos-2


On Mon, Apr 3, 2017 at 11:14 AM, Damien Picard <[hidden email]> wrote:
Hi,

Due to an issue in opencv4tegra, I can not capture from my UVC webcam using OpenCV. To get round this problem, I'm trying to use GStreamer and its Python bindings to capture jpeg images from the webcam.

To do that, I adapt this tutorial with a custom pipeline.
Currently my pipeline looks like this :

v4l2src ! image/jpeg,width=1920,height=1080 ! jpegdec ! videoconvert ! appsink name=sink caps=video/x-raw, format=(string){BGR, GRAY8}; video/x-bayer,format=(string){rggb,bggr,grbg,gbrg}

(The function that convert gstreamer to opencv array is exactly the same as in the tutorial)

It works (maybe the colors are not the good ones, but I'm not sure), but I'm wondering if there is a way to retrieve the jpeg images directly from gstreamer ? By this way, I will decode them using OpenCV and I hope that it could, at least, limits processing.

Not sure if decoding inside opencv or in gstreamer itself makes any difference but yes you can have gstreamer pass the jpeg images to you.

If you pay attention to your pipeline, it contains the 'jpegdec' element that is the one decoding jpegs into a raw format that later gets sent to appsink and into your application. So, you should just remove jpegdec and videoconvert and you will have jpeg images delivered directly to appsink. Remember to also remove the caps restrictions from appsink so it can accept jpeg input. Something like:

v4l2src ! image/jpeg,width=1920,height=1080 ! appsink name=sink

Hope this helps,
 

Thank you in advance.

--
Damien Picard
Expert GWT
Mob : 06 11 51 47 78

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




--
Thiago Sousa Santos

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: From UVC jpeg webcam to OpenCV using Gstreamer

Damien Picard
Thank you !

2017-04-03 20:49 GMT+02:00 Thiago Sousa Santos <[hidden email]>:


On Mon, Apr 3, 2017 at 11:14 AM, Damien Picard <[hidden email]> wrote:
Hi,

Due to an issue in opencv4tegra, I can not capture from my UVC webcam using OpenCV. To get round this problem, I'm trying to use GStreamer and its Python bindings to capture jpeg images from the webcam.

To do that, I adapt this tutorial with a custom pipeline.
Currently my pipeline looks like this :

v4l2src ! image/jpeg,width=1920,height=1080 ! jpegdec ! videoconvert ! appsink name=sink caps=video/x-raw, format=(string){BGR, GRAY8}; video/x-bayer,format=(string){rggb,bggr,grbg,gbrg}

(The function that convert gstreamer to opencv array is exactly the same as in the tutorial)

It works (maybe the colors are not the good ones, but I'm not sure), but I'm wondering if there is a way to retrieve the jpeg images directly from gstreamer ? By this way, I will decode them using OpenCV and I hope that it could, at least, limits processing.

Not sure if decoding inside opencv or in gstreamer itself makes any difference but yes you can have gstreamer pass the jpeg images to you.

If you pay attention to your pipeline, it contains the 'jpegdec' element that is the one decoding jpegs into a raw format that later gets sent to appsink and into your application. So, you should just remove jpegdec and videoconvert and you will have jpeg images delivered directly to appsink. Remember to also remove the caps restrictions from appsink so it can accept jpeg input. Something like:

v4l2src ! image/jpeg,width=1920,height=1080 ! appsink name=sink

Hope this helps,
 

Thank you in advance.

--
Damien Picard
Expert GWT
Mob : 06 11 51 47 78

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




--
Thiago Sousa Santos

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




--
Damien Picard
Expert GWT
Mob : 06 11 51 47 78

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: From UVC jpeg webcam to OpenCV using Gstreamer

filnet
Note that that gstreamer has a number of OpenCV elements that could do what you are after or be adapted to do it.


Le Mardi 4 avril 2017 18h46, Damien Picard <[hidden email]> a écrit :


Thank you !

2017-04-03 20:49 GMT+02:00 Thiago Sousa Santos <[hidden email]>:


On Mon, Apr 3, 2017 at 11:14 AM, Damien Picard <[hidden email]> wrote:
Hi,

Due to an issue in opencv4tegra, I can not capture from my UVC webcam using OpenCV. To get round this problem, I'm trying to use GStreamer and its Python bindings to capture jpeg images from the webcam.

To do that, I adapt this tutorial with a custom pipeline.
Currently my pipeline looks like this :

v4l2src ! image/jpeg,width=1920,height=1 080 ! jpegdec ! videoconvert ! appsink name=sink caps=video/x-raw, format=(string){BGR, GRAY8}; video/x-bayer,format=(string){ rggb,bggr,grbg,gbrg}

(The function that convert gstreamer to opencv array is exactly the same as in the tutorial)

It works (maybe the colors are not the good ones, but I'm not sure), but I'm wondering if there is a way to retrieve the jpeg images directly from gstreamer ? By this way, I will decode them using OpenCV and I hope that it could, at least, limits processing.

Not sure if decoding inside opencv or in gstreamer itself makes any difference but yes you can have gstreamer pass the jpeg images to you.

If you pay attention to your pipeline, it contains the 'jpegdec' element that is the one decoding jpegs into a raw format that later gets sent to appsink and into your application. So, you should just remove jpegdec and videoconvert and you will have jpeg images delivered directly to appsink. Remember to also remove the caps restrictions from appsink so it can accept jpeg input. Something like:

v4l2src ! image/jpeg,width=1920,height=1 080 ! appsink name=sink

Hope this helps,
 

Thank you in advance.

--
Damien Picard
Expert GWT
Mob : 06 11 51 47 78

______________________________ _________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/ mailman/listinfo/gstreamer-dev el




--
Thiago Sousa Santos

______________________________ _________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/ mailman/listinfo/gstreamer- devel




--
Damien Picard
Expert GWT
Mob : 06 11 51 47 78
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: From UVC jpeg webcam to OpenCV using Gstreamer

filnet


Le Jeudi 6 avril 2017 18h21, philippe renon <[hidden email]> a écrit :


Note that that gstreamer has a number of OpenCV elements that could do what you are after or be adapted to do it.


Le Mardi 4 avril 2017 18h46, Damien Picard <[hidden email]> a écrit :


Thank you !

2017-04-03 20:49 GMT+02:00 Thiago Sousa Santos <[hidden email]>:


On Mon, Apr 3, 2017 at 11:14 AM, Damien Picard <[hidden email]> wrote:
Hi,

Due to an issue in opencv4tegra, I can not capture from my UVC webcam using OpenCV. To get round this problem, I'm trying to use GStreamer and its Python bindings to capture jpeg images from the webcam.

To do that, I adapt this tutorial with a custom pipeline.
Currently my pipeline looks like this :

v4l2src ! image/jpeg,width=1920,height=1 080 ! jpegdec ! videoconvert ! appsink name=sink caps=video/x-raw, format=(string){BGR, GRAY8}; video/x-bayer,format=(string){ rggb,bggr,grbg,gbrg}

(The function that convert gstreamer to opencv array is exactly the same as in the tutorial)

It works (maybe the colors are not the good ones, but I'm not sure), but I'm wondering if there is a way to retrieve the jpeg images directly from gstreamer ? By this way, I will decode them using OpenCV and I hope that it could, at least, limits processing.

Not sure if decoding inside opencv or in gstreamer itself makes any difference but yes you can have gstreamer pass the jpeg images to you.

If you pay attention to your pipeline, it contains the 'jpegdec' element that is the one decoding jpegs into a raw format that later gets sent to appsink and into your application. So, you should just remove jpegdec and videoconvert and you will have jpeg images delivered directly to appsink. Remember to also remove the caps restrictions from appsink so it can accept jpeg input. Something like:

v4l2src ! image/jpeg,width=1920,height=1 080 ! appsink name=sink

Hope this helps,
 

Thank you in advance.

--
Damien Picard
Expert GWT
Mob : 06 11 51 47 78

______________________________ _________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/ mailman/listinfo/gstreamer-dev el




--
Thiago Sousa Santos

______________________________ _________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/ mailman/listinfo/gstreamer- devel




--
Damien Picard
Expert GWT
Mob : 06 11 51 47 78
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel





_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Loading...