开发者

Algorithm for picking brightest/most diverse image from a group?

开发者 https://www.devze.com 2023-02-28 10:26 出处:网络
I have 100 images extracted from a video to use as a thumbnail in a gallery. My C# application needs to pick which one is the most \"interesting\" - or which one will entice the user to view the video

I have 100 images extracted from a video to use as a thumbnail in a gallery. My C# application needs to pick which one is the most "interesting" - or which one will entice the user to view the video after seeing the thumbnail.

Obviously some are more exciting than others; a black frame isn't exciting,开发者_运维百科 neither is a pure white frame. Thus far I've come up (arbitrarily) with the following factors for what makes an image "stand-out" in a group.

  • Should have a high level of brightness, but not totally white. Maybe averaging a brightness of 50% - 75% on a scale from black to white.
  • Should have a diverse set of colors. Assuming this can be measured, images with the widest range of colors should stand out in the group.

How can these factors be calculated? Any other improvements that could pick the best image in a group?


You also want the thumbnail to be representative of the video. Try this: Create N candidate thumbnails (evenly spaced in the video), create an average thumbnail by averaging the candidates, and then select the actual thumbnail that is closest to the average.


Have a look at the Video Tapestries paper from SIGGRAPH 2010. Obviously this is complete overkill for your project, but look over the previous work section. Hopefully will give you an idea about how you might go about deciding what material is interesting and representative.


Using your proposed method, you can collect statistics on the Hue and brightness of each pixel, then calculate the mean and standard deviation of each. A higher stdev represents more diversity.


Check out this page to transform RGB to HSL(Hue, Saturation, Luminance):

http://130.113.54.154/~monger/hsl-rgb.htmlenter link description here

I haven't tried those equations, but I believe they will give a decent estimate without being too computationally intensive. There is plenty of information out there on how to convert RGB to HSL if those don't work well.

Once you have done that, Luminance represents "Brightness." Hue and Saturation together would represent the "Color." Hue is the tint (is this a green or a red), while saturation is the intensity of the hue.

To determine the brightness of a picture, just look at it's Luminance (L) value.

To determine the color "range", as a first attempt I would do something like computing the vector sum of the Hue and Saturation. This should give you a "distance away from white." Something like:

Color Strength = Sqrt(Hue^2 + Saturation^2)

Find the two pixels with the min and max color strength, then subtract them to get a rough measure of how diverse the colors are.

You probably want to subsample each image, in other words, only calculate the HSL for a small amount of pixels from each image. You will have to play around with what samples to calculate. It may be best to take something like an 8x8 block from the center and each corner, calculate the average HSL for those blocks, then use them in your calculations.

I haven't actually tried any of this just have some remedial background in color spaces, so hopefully this is helpful.

0

精彩评论

暂无评论...
验证码 换一张
取 消