How to compare images and determine who has more content?

Purpose: I want to capture the best frame from an animated GIF and use it as a static preview image. I believe that the best frame is the one that shows the most content - not necessarily the first or last frame.

Take this GIF for example:

enter image description here

-

This is the first frame:

enter image description here

-

Here is the 28th frame:

enter image description here

It is understood that frame 28 represents the entire GIF well.

How can I programmatically determine if one frame has more pixel / content over another? Any thoughts, ideas, packages / modules or articles that you can indicate to me will be very grateful.

+6
source share
3

entropy .

"" . , , . , Arthur-R, - , .

. , , , 1 ( 0 255). , 1. .

, ,

H = E[-log(p(x))]

H - , E - , p(x) - , x.

H , -p(x)*log(p(x)) p(x) , .

.

enter image description here

21 (22- ), .

enter image description here

  • , . , , , ( ). , , .

  • , - ( ), , . , (H = 8 ), .

enter image description here

Ruby

ruby, , .

m. simon borg

FWIW, Ruby File.size(), 1904 28- 946 - . simon borg

File.size() .


, 200x200 , , 40 345 , 40 000 . , .

+6

, . ( , , , !) , , , (, , ) , / . , , , .

/ GIF (, , ), , , t .

/ , , .

+1

I think you can choose an API, such as the Restful Web Service, for this, because without it it is so difficult. For example, these are some well-known APIs:

https://cloud.google.com/vision/

https://www.clarifai.com/

https://vize.ai

https://azure.microsoft.com/en-us/services/cognitive-services/computer-vision/

https://imagga.com

0
source

All Articles