I am trying to detect and hide a logo that dynamically positioned in a video.
In this video the logo is positioned at the top and after a few minutes down etc.
it's possible to detect every time the logo when it changes place and hide it with ffmpeg?
I tried with delogo but I must tell the position x/y, so it is not possible in my case!
Thank you very much!
Edit: It cannot and should not be done. Ignore the everything after this.
Simple idea but likely a complex execution.
I would be shocked if ffmpeg had functionality to do this in a strait-forward manner. You could manually find every logo shift, use ffmpeg to cut the video on those points, manually use your delogo tool for each, then concat them back together again?
If you want to automate this then you're likely doing to have to do a bit of image processing coding. I'm not going to code it but I'll go through a few highlights.
First, ask what you are looking for?
Is the logo a static block that covers what it is over? Is it slightly transparent? Does it change size? Does it change in intensity?
I don't know how much effort went into creating the logo so I can only make guesses.
If its static and entirely in the foreground, then this is a simple search followed by a replacement with whatever you want. easy
If its slightly transparent but of constant size, you will want to reverse-engineer the template they used, search each frame for that pattern, then undo it.
If they got fancier and you want this to be automated then you'll be delving into machine learning and more advanced techniques.
I can think of a whole plethora of nice features for an application like this but that's enough to likely make a start.
Related
So I'm making a game with my group on processing for a project and we all have different computers. The problem is we built the game on one computer, however at this point we have realized the the (1200,800) size we used does not work on our professors computer. Unfortunately we have hard coded thousands of values to fit on this resolution. Is there any way to make it fit on all computers?
From my own research I found you can use screen.width and screen.height in order to get the size of the screen, I set the game window to about half the screen size. However all the images I had loaded for background and stuff are 1200x800 So I am unsure how to go about modifying ALL of my pictures (backgrounds), and hard values.
Is there anyway to fix this without having to go manually change the 1000's of hard values? (Yes I am fully aware how bad it is I hard coded the numbers).
Any help would be greatly appreciated. As mentioned in title, the language is processing.
As I'm sure you have learned your lesson about hard-coding numbers, I won't say anything about it :)
You may have heard of embedding a processing PApplet inside a traditional java JFrame or similar. If you are okay with scaling the image that your PApplet draws (ie it draws it at the resolution that you've coded, and then the resulting image is scaled up or down to match the screen), then you could embed your papplet in a frame, capture the papplet's output to an image, scale the image, then draw it to the screen. A quick googling yielded this SO question. It may make your game look funny if the resolutions are too different, but this is a quick and dirty way. It's possible that you'll want to have this done in a separate thread, as suggested here.
Having said that, I do not recommend it. One of the best thing (IMO) of Processing is not having to mess directly with AWT/Swing. It's also a messy kludge and the "right thing to do" is just to go back and change the hard-coded numbers to variables. For your images, you can use PImage's resize(). You say your code is several hundred lines long, but in reality that isn't a huge amount-- the best thing to do is just to suck it up and be unhappy for a few hours. Good luck!
Assuming a simple product demo e.g. the one found on http://www.sublimetext.com/
i.e. something this isn't traditional high res video and could be reasonable accomplished with:
animated gif
video (can be embedded youtube, custom html5 player, whatever is most competitive)
canvas
The question is, which performs better for the user? Both in terms of:
The size of the files the user must be downloaded to view the 'product demo'
The requirements in terms of processing power to display the 'product demo'
If you feel that there's a superior technology to accomplish this or another metric to judge its usefulness, let me know and I'll adjust accordingly.
I know it's already answered, but as you specifically referred to the Sublime Text animation I assume you're wanting to create something similar?
If that's the case then here is a post explaining how it was created by the Sublime Text author, himself:
http://www.sublimetext.com/~jps/animated_gifs_the_hard_way.html
The interesting part of the article is how he reduces the file size - which I believe is your question.
With a simple animation such as the one at the link you're referring to, with a very low frame rate, a simple animated-PNG of animated GIF will probably be the best solution.
However, you need to consider band-width factor in this. If the final size of the GIF or the PNG is large then probably a buffered video is probably better.
This is because the whole gif/png file needs to be downloaded before it shows (I am not sure how interleaved PNGs works when they contain animation though).
A video may be larger in file size, but as it is typically buffered you will be able to show the animation almost right away.
Using external hosts such as YouTube or others can be beneficial to your site as well as the band-width is drawn from those site and not from your server (in case you use a provider that limits or charge for this in various ways).
For more information on animated PNGs or APNG (as this is not so well-known):
https://en.wikipedia.org/wiki/APNG
The canvas in this is only a displaying device and not really necessary (an image container does the same job and can also animate the GIF/PNG whereas a canvas cannot).
If you use a lot of vectors then canvas can be considered.
CSS3 animation is also an option for things such as presentation slides.
I am working on a game and I need to have two characters talking to eachother. I know that XNA does not allow me to play a movie other than fullscreen so I need to actually "play" the animation inside my game app in a different manner. The characters have animated environments around them so the animations are not simple head movements and as such, animating the characters via keyframing in a 3d model is not an option. The dialogue between the two characters is a cut-scene between levels, so it is not part of the gameplay itself.
I am not sure what the best approach to this would be so if you have any ideas, please let me know.
This is what I thought of so far:
1. Create all the individual frames for the characters as images. Load these images in a spritesheet and go through each frame at my desired framerate.
The problem with this approach is that the maximum spritesheet texture of 2048x2048 would not allow for too many frames as the characters are something around 300x200. The other problem is that I have two characters so, the minimum scenario would require me to create in memory two 2048x2048 spritesheets... and I'd like to keep the memory requirements low.
2. Load a batch of frames (images), play them, then de-allocate them and load the next set. I know that in general it is not a good idea to load lots of small textures and switch between them in drawing calls (performance wise) but it seems as though I have no other choice in this case.
I am afraid that unloading stuff from memory and loading other stuff in while in the Update-Draw loop would slow down the entire scene... so not sure if this is a sane approach.
The other idea is to make an mp4/wmv with the whole thing [char animation, subtitles of the dialogue, etc] but the interface that hosts these characters would not be as "smooth" as when rendered directly, etc...
Thank you for all your suggestions,
Marius
EDIT 1:
I have tested scenario number 2 and it seems that the performance is OK.
I have used scenario 2. It works for my particular case but I am sure it won't work for all cases.
I have the following 2 consequative, unaltered frames from a video:
For some reason the camera made the 2nd much 'washed out' than the first. I want to make the 2nd look more like the 1st.
In the video I'm trying to process, there are lots of cases like this, where the 'exposure' changes suddenly from one frame to the next. I am able to find this parts of the video by looking at the image histogram for each frame, and when 2 adjacent frames have histograms that are too far apart, it's where this has happened. I can find this sections of different exposure, but I'm stumped with how to fix it.
As a programmer I'm familar with ImageMagick and that's about it. Since I have lots of frames, some automated hand off approach to fix this is by far the best solution. I am also totally unskilled with graphics editing programmes.
I've tried changing the exposure in imagemagick (with -level 0,50% etc.), but that doesn't help.
What ImageMagick commands (or other FLOSS image editing tools) will make the 2nd image look more like the 1st?
As some people have pointed out in the comments, the problem is the colour balance. Changing the colour balance makes the 2 images more similar.
Is there a tool that would reveal whether an image contains a watermark and read, alter or remove a watermark if used by someone who is not the creator of the watermark?
Edit to try to reflect Kerzin's intent, as indicated in the comments: This is not for the purpose of knowing how to do it, but whether it can be done by others to remove watermarks from created images, and how it can be made more difficult.
In general:
to detect a watermark that is not visible to the naked eye you need to have some idea of the encoding scheme
it is possible to come up with a watermarking scheme that yields a watermark one cannot read or definitively confirm the presence of without knowing a secret, however in general that is not the purpose of a watermark
a watermark that does not distort the image sufficiently to be obvious to the naked eye should in general be removable by manipulations that similarly do not degrade the signal sufficiently to be obvious to the naked eye; however, coming up with the required manipulations may be hard and will certainly require specific knowledge of the watermarking scheme.
It depends on the type of watermark you're creating. I'm assuming you're talking about an opaque or semitransparent logo or text that is usually placed in a corner of the image.
There is a balancing act here. If the watermark is small enough, users can always just crop it out. But if you make it too large, you make the image unusable. Sometimes this is the intent (for example, look at iStockPhoto.com: they use big watermarks over the center of the image so that you can't use the image without buying it). Other times, you don't want to do this (say you're posting a wallpaper to DeviantArt: you still want people to use the image, but no one's going to use it if the watermark takes up a third of the screen).
If the watermark covers a part of the image that is not too detailed, users who know what they're doing can use the clone brush or other tools to photoshop it out of the image. (The same way I once removed ugly power lines from an otherwise beautiful sunset photo.)
Also, if the watermark is in the same place on all images, and it is transparent enough, sophisticated users can build a filter based on the common pixels from several of your images. In the right circumstances, such a filter can work like magic. (But usually it won't.)
Most of the time you won't be able to remove the watermark. Not even manually.
Unless it is a real simple and/or badplaced watermark and the image itself is easy to reconstruct too.
There are a few tools that claim to be able to remove watermarks but I don't know of any which really are up to the task