I
I
Ivan Suroegin2016-01-21 17:05:42
Python
Ivan Suroegin, 2016-01-21 17:05:42

Image/video match analysis with Python. How to do it better?

Good evening!
I've run into a problem that I can't solve. I tell below.
There is an animated banner .gif, it is also placed on the site page. You need to make sure that the program analyzes the page with the banner and takes a screenshot at the right moment when the image is shown in the banner.
As far as I understand, how this can be solved in general:
0. Libraries such as Selenium are used (take screenshots), openCV (for image analysis and, it seems possible, video - but how to combine them then?
1. First, you need to take a screenshot (in .jpg format) from the banner at the right moment (you definitely need to do this), so that you can find the same moment on the page with the banner.
2. Feed a screenshot from the banner to the program, then the page with the banner opens and a check for matching images begins (part of the entire screen (that is, just a banner on the site page) matches the screenshot of the banner with the right moment), after which a screenshot is instantly taken the entire screen.
Haven't started development yet... Where to start at all, where to dig?
Or, perhaps, it is not realistic to do this, because. a very large load is created, as I understand it? ..
There are options more abruptly \ simpler?
I will be very glad to your hints. :)
Sincerely,
Ivan.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
cardinalus, 2016-01-21
@ivan_suroegin

If as an advice, then the following option may suit you:
- launch the browser
- at intervals of X time (for example, 1 second) take a screenshot using OpenCV (considering that the banner usually does not "run" around the screen, then even immediately crop the resulting image to size banner, the same OpenCV)
- for each picture, make a comparison with the original
- if it matches - the screen is saved, if not, we start over
How does the task resemble the creation of a bot (for example link )

T
throughtheether, 2016-01-21
@throughtheether

and took a screenshot at the right moment of displaying the image in the banner..
An interesting task. This right moment - what is it due to?
If you need to have the desired frame of animation in the screenshot, why not take a screenshot, download the gif file and then mount the desired frame in place of the banner?
a screenshot of the entire screen is taken immediately.
I'm afraid this ("instantly") is not about selenium.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question