IdeaMonk

thoughts, ideas, code and other things...

Sunday, August 17, 2008

Dazzle hard :(

Just tried out luminosity based size of squares. The darker areas are filling well similar to the original image.
But even this isn't bringing out the exact effect. Looks like there has to be some way to decide which area is variationless -> put bigger squares there.. the areas which have loads of variation, put tiny squares there.
How to detect degree of variation ??!! :X (click to enlarge)
 for (int i=0;i<times;){
//width = bmin + rand() % (bmax-bmin);
// LUMINANCE ****
px = rand() % base->w;
py = rand() % base->h;
color = getpixel(base,px,py);
r=getr(color); g=getg(color); b=getb(color);
lumin = (0.2126*r) + (0.7152*g) + (0.0722*b);
width = bmin + (int) ( (float)(bmax-bmin)*(lumin/255.0));
if (color != makecol (255,0,255) ){
// Fill only for non transparent regions
rectfill (target,px-width/2,py-width/2,px+width/2,py+width/2,color);
if (lumin>100) i++;
}
}

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home