[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Message from Mark re: C++



> Yikes.  As far as I know, the Microsoft Visual-C/C++ runtime routines
> are freely redistributable.  Anyone know different?

Oops. Looks like I missed something. I think I've heared something like this
about Borland but I may be wrong of course. Never mind.

>> difference). My filter also run a "contrast autostretch"
>
>what do you mean by contrast autostretch?

I mean "find darkest and lightest pixels of the image and stretch the
brightness range so the first one become black, the second - white".
Photoshop's native "Image/Equalize" does exactly this. I think it's
necessary since difference (especially on low blur radii) is small, you
often don't see it at all. Hm... here go the code fragment (just a fragment,
not a filter!):

// -----------
// Apply Edges
// -----------

if (edges) {
 int temp=0;
 for (y=0; y < Y; y++) {
  for (x=0; x < X; x++) {
   for (z= 0; z < 3; z++) {
    tset(x,y,z, dif(src(x,y,z), tget(x,y,z)));
    temp=max(temp, tget(x,y,z));
   }//for z
  }//for x
 }//for y

file://one more pass - contrast autostretch

 for (y=0; y < Y; y++) {
  for (x=0; x < X; x++) {
   pset(x,y,3, src(x,y,3)); file://preserve transparency
   for (z= 0; z < 3; z++) {
    pset(x,y,z, scl(tget(x,y,z),0,temp,0,255));
   }//for z
  }//for x
 }//for y

}//if

here the filter operate on array "t" (with tget/tset commands) where the
previous part put the blurred image to. I assumed the min difference is 0,
so I need to find max difference signal across the image (it is stored into
int "temp") then fill the resulting image (pset command) with
scl(tget(x,y,z),0,temp,0,255) instead of tget(x,y,z). This way I get
resulting image fit in full [0..255] brightness range instead of narrow
[0..temp]. I think this filter may be done better if I insert "inverse
edges" (black on white instead of white on black) and so on... until the
next release <g>...

Ilyich.
--------------------------------------------------------------------------
Ilya Razmanov (a.k.a. Ilyich the Toad), Institute of Organic Chemistry RAS
http://www.chat.ru/~bufo/ - Freeware Photoshop Filters and Design Showcase
- I've just killed a guy.
- I'm just about to. - Full Throttle
--------------------------------------------------------------------------