Hide wowza overlay after an interval of time - wowza

I am using Wowza Media Streams for a live streaming in my project. I am using overlay on video. My question is, that I want to hide displaying overlay after an interval of time. Please guide me is there any way to do this. My code is for using overlay is
wowzaImage = new OverlayImage(basePath+"logo_14.png",100);
mainImage.addOverlayImage(wowzaImage,srcWidth-wowzaImage.GetWidth(1.0),0);
This is being used to display overlay. To Hide this overlay after fix time, I tried this
mainImage.addOverlayImage(null,srcWidth-wowzaImage.GetWidth(1.0),0);
But this didn't work. Also tried
wowzaImage = new OverlayImage(basePath+"logo_14.png",0);
mainImage.addOverlayImage(wowzaImage,srcWidth-wowzaImage.GetWidth(1.0),0);
But it still shows overlay there.
Please help, Thanks

If you are looking at the example here you can find a couple of ways to accomplish this (depending on how you've set it up). You can leverage the add fading step convenience function as follows:
mainImage.addFadingStep([start-value],[end-value],[number-of-frames]);
Otherwise you can fade the image itself away on each frame (see onBeforeScaleFrame event handler) similar to the way you were suggesting in your question:
OverlayImage img = new OverlayImage([resource], opacity);
mainImage.addOverlayImage(img,xpos, ypos);
For the latter you will want to be sure it is being referenced correctly and that the positioning holds true.
Thanks,
Matt

Related

How to remove a specific background from a video (OpenCV 3)

I am relatively new to OpenCV. My program will have a fixed camera that will track insects moving passed it. I figured that this would mean that I could remove the background from the video. I have attempted to use the method (which I found in a tutorial - http://docs.opencv.org/3.1.0/d1/dc5/tutorial_background_subtraction.html#gsc.tab=0):
pMOG2 = cv::createBackgroundSubtractorMOG2();
..
pMOG2->apply(frame, background);
However, how does this determine the background?
I have tried another way, which I thought might work, which was to capture the background when the program first starts and then use absDiff() or subtraction() on the background and current frame. Unfortunately, this results in a strange image which has parts of the static background image displayed over the video, this messes up the tracking.
I am a bit confused as to what would be the best way to do things. Is it possible to remove a specific background from each frame?
Thanks!

QApplication::processEvents not working in Windows

I am working on a project that presents live data acquired in real-time using the QCustomPlot plug-in for Qt. The display has a black background color, and the multiple channels of data are colored differently. When taking a screenshot, we would like to make it printer-friendly, so the background is white and all data is black. I am thinking of a solution like this:
Change all colors the way I want by manipulating the pointers for the graphical objects
Grab the screenshot using QWidget::grab() to get a QPixmap
Change all the colors back to normal
This did not work at first, because the system could not change the colors in time for the screenshot to be taken. So I used a QApplication::processEvents(), and it all worked on my Mac.
However, it does not work on a Windows 7 (which is required). Any ideas what to do?
Code:
QSting fileLocation = "...";
toggleColors(false); //function to toggle the colors
QApplication::processEvents();
QPixmap shot = grab();
toggleColors(true);
shot.save(fileLocation, "png");
Again. It works on Mac, but not Windows.
Update 1. Content of toggleColors include:
if(enable)
ui->plot->setBackground(QBrush(Qt::black));
else
ui->plot->setBackground(QBrush(Qt::white));
ui->plot->repaint();
I also tried with ui->plot->update() instead.
I am not sure what is the problem on Windows specifically, but I recommend you calling QWidget::update() on the given widget. That forces the next update to re-render itself.
On the other hand, I'm not sure why toggleColors() didn't somehow cause that to happen.
Also, ensure that QWidget::setUpdatesEnabled(bool) wasn't set to "false."
It appears the problem lies with QCustomPlot. It was solved by performing a ui->plot->replot() which is specific to QCustomPlot and not QWidget.

what is name of this transition effect?

This is the link http://codecanyon.net/item/estro-jquery-ken-burns-swipe-effect-slider/full_screen_preview/235111
What is the effect name of image transition in that slider? And how to achieve it? Is it zoom in and moving the image at the same time?
The name of that effect is Keb Burns (or Pan and Zoom effect).
I don't think you can achieve it only with css-transitions. You should use some JavaScript/jQuery.
Look at this example. You should background-poistion,background-size properties to get it. I hope the example code is helpful to get it.
and tutorial on background properties.
moving background is based on background-position.
changing the image require jquery.

GTK 3 transparent label with text placed over image

i need to create GTK GUI with image and transparent label (darker) that is placed over the image. The first problem is overlapping. I tried Gtk::Table and Gtk::Fixed container but it behaves strangely. The second problem is transparency. I would like to use CSS styles or transparent background image. Is there anybody who can help me posting some sources or examples? Thanks
You could subclass GtkWidget, or GtkDrawingArea since I think it will be faster than the altenatives. But you could use GtkOverlay, plus GtkImage and GtkLabel to acomplish what you're looking for.
gtk3-demo app that comes with Gtk+-3.0 give some examples of how to use GtkOverlay.
Maybe you could give a look to clutter-gtk ? You can do nice things with it.

what's the best way to display images in qt? also I would like to zoom in to particular areas as well

I've been using label to display images. I'd like to be able to click and create a bounding box then be able to drag the cursor to move around in the image. What would I need to do this? Thanks.
I'm not 100% sure I understand what you are trying to do, but I think the QGraphicsScene is what you are looking for. You can (among many other things):
Render images (QGraphicsPixmapItem, for example)
Change the zoom level when rendering the scene on a QGraphicsView.
Select things using a "rubber band"
Move items around with the mouse (see QGraphicsItem::ItemIsMovable)
etc.
You may need to get familiar with Qt's graphics view framework.