• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Post reply

Other options

Shortcuts: ALT+S save/post or ALT+P preview

Topic summary

Posted by Galfar
 - 28 July 2011, 21:59:26
Hi,

resizing image and reading center pixel is a good idea but you can do it faster:
Resizing with filtering basically computes average color for certain area of pixels
bu also reallocates memory, uses fancy filters, etc. You can do the averaging manually, just read some
pixels from the area you're interested in and compute the average color.

To get it even faster don't sample every pixel, but say every 3rd (maybe depending on the size of source image). Also read the pixels directly using pointers when you know the images will be all be in the same data format (usually 24bit RGB) or in just few formats.
Posted by binfch
 - 25 July 2011, 19:22:02
Hi there

I have 10 different RGB colors (example red, blue, green, etc...).

Now I need to read foto files (.jpg, .gif, .png) and decide to what preset color the images best fits to. Example -> let's supose on the foto there is a white cloud in the center surrounded by blue sky -> The result should then be the color "white". Or a black dog on a green lawn -> The result should be the color "black".

P.S: Google image search has such a functionality.

I was wondering how such a functionality could be implemented resp. what would be the most "performant" solution. An idea that comes to my mind is to simple resize the images to 3x3 pixel, then read the center pixel and decide what color is closest to it...

Thx & cheers,
Peter
SMF spam blocked by CleanTalk