Algorithms:
1. Sort each pixels based on the brightness into a heap.
2. For each pixel grows the spiral
%% accum is the accumulation; target is the goal; counter is
%%for a long spiral over the limit
(1): initial states: accum = 0; target = 255; counter = 0;
(2): grow the spiral( for each step the real codes as follows)
%% full; stop
if(accum >= target) break;
Ii = ppTemp[v.y][v.x].GetGreyscaleValue ();
%% return the increase based on the accumulation function
out = accumulate(I0,Ii, m_ppDoneMap[v.y][v.x]);
accum = accum + out;%% accumulation
%% update the original image and the done map
in = min(255,Ii + out);
ppTemp[v.y][v.x] = COLOR(in, in, in);
m_ppDoneMap[v.y][v.x] =0;// flag for used pixels
%% the error at the last pixel
if (accum > target)
{
in = Ii-(accum-out-target);%% too much
ppTemp[v.y][v.x] = COLOR(in,in, in);
}
%% counter for the length of the spiral
counter++;
%% too long and cut it out; might have a problem
if(counter>spiralmask.size ()) break;
---------------------------------------------
%% the accumulation function
int accumulation(...)
{
Ti = 80;
if(255-Ii less than Ti)
in = 255 - Ii;
else
in = Ti;
return in;
}
---------------------------




