Tuesday, July 21, 2009

Better for tone change but artefacts are too clear.

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;
}
---------------------------
Intensity response diagram based on the ramp image
Some results



2 comments:

  1. Thanks for this post, very informative.

    I can see two potential problems:

    small problem: do you take all the darkness from the first pixel in the spiral (where you placed the black pixel)? I don't see in the code where that happens, but you have to do it.

    bigger problem: do you put the modified pixels back in the heap? It looks like you sort at the beginning and use the same order the whole time. But you actually want to delay hitting a particular pixel if its darkness was reduced by a spiral. If you keep the same order, you will get clumping. (It will be slower to run when you allow dynamic ordering, but let's figure out how to speed it up once we have it doing the right thing.)

    ReplyDelete
  2. There might be the first problem, but I already take care of the second problem.

    ReplyDelete