![]() |
Drawing On Top Of Video Stream (QT & gstreamer & gstxoverlay)
I want to draw on top of a video stream. I wrote a QT application that shows the video stream as an xoverlay, whcih is overlayed over a QWidget object (More detail can be found in this post).
I tried to add a QPixmap to the QWidget, but, as I expected, the xoverlay (video stream) covered the QPixmap object, so you could not see the drawing bellow. I found suggestions to use qt4-x11 library. Checked it out and it looks quit complicated. Any other suggestions on how to overlay a QWidget over the xoverlay? Klen |
Re: Drawing On Top Of Video Stream (QT & gstreamer & gstxoverlay)
try asking the author of Burgerface :D - he has managed to do it :D
|
Re: Drawing On Top Of Video Stream (QT & gstreamer & gstxoverlay)
Maybe you should search qtcartoonizer in https://garage.maemo.org/ and look at camera.cpp that's good example for how use camera with QT in Maemo.
BTW, i already posted same in your post http://talk.maemo.org/showthread.php...d=1#post555080 |
Re: Drawing On Top Of Video Stream (QT & gstreamer & gstxoverlay)
Quote:
Thanks. Klen |
Re: Drawing On Top Of Video Stream (QT & gstreamer & gstxoverlay)
I checked qtcartonizer. The example is exactly what I am looking for, however, the camera part of the application does not work on my N900.
When I install the deb package I get an error on two dependencies, but I guess they are just errors in the deb packing as those packages are installed on my phone. Thanks funpig. Klen |
Re: Drawing On Top Of Video Stream (QT & gstreamer & gstxoverlay)
which dependencies are erroring? :D
|
Re: Drawing On Top Of Video Stream (QT & gstreamer & gstxoverlay)
Quote:
So, i create my QCamera object and gstream initializes ok. Then I create a videoLabel object (like they do) but i can't make it play any video. everytime I call camera->play() nothing happens. cerr returns "camera emit video not ready". I'm really missing something here... can someone help? please? Thanks |
Re: Drawing On Top Of Video Stream (QT & gstreamer & gstxoverlay)
Quote:
|
Re: Drawing On Top Of Video Stream (QT & gstreamer & gstxoverlay)
I have the same problem with qtcartonizer. When I request a photo the camera emits signal "camera emit video not ready". I reported the bug on the garage development page. No reply so far.
If you manage to get any progress, pleas post it. Cheers, Klen |
Re: Drawing On Top Of Video Stream (QT & gstreamer & gstxoverlay)
One example application that does drawing over the video stream is BurgerFace. Unfortunately there is no source code available, however, jfk gave some guidance on technology he used to implement the application.
His replies can be found on here. To sum up: jfk used SDL libraries to implement BurgerFace application. For capturing images from the camera he used V4L2, however he suggests gstreamer might be more user friendly. One of the reasons why he used SDL instead of xoverlays is that overlays cause flickering when drawn upon a camera stream. I also noticed this problem when i was changing the size of the camera stream window. I also analyzed the qtcartonizer code in more detail and figured out that the application only draws on top of a static taken by the camera and not onto a live video stream. Therefore, the application does not face the limitation issue of the overlay. Has anyone any idea what is causing this flickering in overlays and how to fix it? Unfortunately I have not got the source code to show you. Thanks for help. Klen |
Re: Drawing On Top Of Video Stream (QT & gstreamer & gstxoverlay)
Final Conclusion on using Xoverlays in QT:
Spent some time on trying to draw a Qt widget on top of xoverlay stream and found out that is can be done, however when you make the widget transparent, you do not see the xoverlay that lies bellow it but the background colour of the widget on which the xoverlay was added. This means that alpha blending also does not work, as it blends with the background colour of the widget bellow instead of the video stream. This means that the whole area that is taken by the widget that holds your picture or text or graphic will cover the overlay. The workaround this problem is to create a mask over your widget which will make sure to cut out only the area you want to overdraw. For example you can cut-out text from the whole widget are and in this way achieve to draw it on top of the video stream without the background colour (the background is the video stream itself). However this approach dose now work well with graphics that have transparent backgrounds and is suppose to slow down your drawing process. Furthermore, I can also confirm the flickering problem that happens when one trays to draw on top of xoverlay. In my case i tried to hide and show the widget containing a simple graphic which caused flickering and sometimes failed to redraw the area from which the overlay was removed. I decided to drop overlays and instead try to capture an image from gstreamer pipeline and draw it draw it as a pixmap on-to QWidget. Got stuck with gstreamer pipline work a need help. Thanks, Klen |
Re: Drawing On Top Of Video Stream (QT & gstreamer & gstxoverlay)
Quick update on this thread:
I managed to crate a pipeline with an appsink element. In this way I get access to raw image data from the pipeline. From the data, I also manage to create a QPixmap and draw it onto the QWidget. All sounds fantastic, but unfortunately I am stuck again. Now the problem is that my appsink works way to slow to achieve a smooth video preview (approx. 15fps). It does not seam to get much faster if I remove all of the drawing on the screen, however, the processor monitor shows much less activity. I tried retrieving data using signals and callback functaions: g_object_set (G_OBJECT (image_sink), "emit-signals", TRUE, NULL); g_signal_connect (image_sink, "new-buffer", G_CALLBACK (new_buffer_added), NULL); as well as calling gst_app_sink_pull_buffer in a timer. GstBuffer* buffer = gst_app_sink_pull_buffer(appsink); There was no difference in speed. Any suggestions? Thanks, Klen |
Re: Drawing On Top Of Video Stream (QT & gstreamer & gstxoverlay)
I opened a new thread with the same tittle on Froum Nokia.
http://discussion.forum.nokia.com/fo...804#post716804 Klen |
All times are GMT. The time now is 01:08. |
vBulletin® Version 3.8.8