How to track the disappearance of an object (TV logo) from the ROI (logo rect on a frame)? - c++

I have a TV logo image and a rect where the logo is placed on almost all video frames. But there are also frames where the logo completely disappears (at least 10 consecutive seconds of running frames). TV logo is placed only in only one place (ROI = full logo rect) throughout the video, so I don't need to analyze full frame. I tried matchTemplate in ROI using OpenCV, it works, but I don't think this way is good enough. How can I track when there is no logo in this area (ROI) with OpenCV with the exception of template matching?

Related

Remove background after getting bounding boxes

I am using YOLOv7 for object detection. After passing a video through the object detector I want a new video which only contains the bounding boxes (no background).
For example, if the video contains a cat the output video should have a white background and a moving box where the cat was detected.
Is there a way to achieve this?

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!

Is it possible to use OpenCV TemplateMatching with a patch images dimensions or background color only?

I am using OpenCV on iOS to detect a rectangular label to assist users in snapping a photo of that label. I have an overlay that presents once the matches threshold is met.
My question is, does that patch image used have to be exact? The labels I am detecting have text on them that vary from label to label. All the same font but different characters. Is it possible to train OpenCV with a patch images color and/or size/dimensions? Or is there perhaps another way around this issue?
Here is a close example to the labels Im scanning, EXCEPT THERE ARE NO ICONS AND ALL ONE FONT TYPE.
Here is the tutorial I am following, which is achieved with an image of a target. http://www.raywenderlich.com/59999/make-augmented-reality-target-shooter-game-opencv-part-3

How to Place the image at specific location of the Picture Conrol in VC++

I m trying to overlay an image on a live video.The IDE used is Visual Studio Professional 2010. The code is developed in C++.When I try to overlay image on the live video, I m loading the image using a handle i.e.
HANDLE hBitmap;
hBitmap = LoadImage(NULL, L"C:\\Users\\User\\Documents\\Visual Studio 2010\\Projects\\BMP_Image.bmp",IMAGE_BITMAP, 0,0, LR_LOADFROMFILE );
I am using the mechanism of Alpha Blending to overlay the image on to the video. Problem I have encountered is, The image is overlayed five consecutive times on to the video .
I m passing the ID of a picture control, placed on the dialog box in the rc file, to load the live video and display it. I m not using any MFCs in the code. The video is rendered by using Direct 2D mechanism
The video resolution is 640*480 and bitmap image resolution is 128*128. If I take this bitmap , the video will produce five times of overlayed image on to the video..
I got the coordinates of dialog box using GetWindowRect() and ScreentoClient(). But I want the coordinates of the Picture control.
I have following doubts:
How to get the coordinates of the picture control???
How to place the image at specific location in a picture control???
Looking forward for ur positive response as earliest...
Regards,
Vivek
You can use the following function for retreiving the handle of your picture control:
::GetDlgItem( hWnd of your dialog, Id of your picture control)
By retreiving its handle, you can get to other info like its position, size and
::GetWindowRect(hWnd, &rc)
If you overlay the image through some API calls such as StretchBlt, you can place it anywhere you want.

Cocos2d-iphone load large scrollable image like "plant VS zombie"

How to I load a very large image eg 1024*4608 using cocos2d-iphone and be able to scroll the image?
Your application will be more responsive if you break up your very large image into tiles. Tiles are smaller images, usually 256 X 256, that can be reassembled by your application into the large image. You display just the tiles that are visible. This uses less phone memory.
Here's a blog post with some Cocos2D-iPhone image scrolling.