> From: [EMAIL PROTECTED]
> To: [email protected]
> Date: Tue, 2 Sep 2008 04:26:36 -0500
> Subject: RE: need math help
>
>
>
>
>> Date: Tue, 2 Sep 2008 00:43:00 -0700
>> From: [EMAIL PROTECTED]
>> To: [email protected]
>> Subject: need math help
>>
>> Man, my math skills are getting kinda dusty.
>>
>> I've got a function of p (written in c)
>> f = pow(p, (log 0.5)/log m)
>> where m is a parametric constant 0<=1.
>> It /can be shown/ that f is also in the range [0,1]
>>
>> What does this function look like? It seems that it _shouldn't_ be that
>> hard, but I find my head won't seem to work.
>>
>> I know what it is for some values of m:
>> for m=approaching 0 f=> p**0 = 1
>> for m=0.5, f= p**1 = p
>> for m=approaching 1, f= p**-BIG => 0
>
>
> Your last point is partially wrong. as m approaches 1, log m approaches 0,
> from the negative side. log .5 is -.301. So -.301/an infinitely small
> negative number is a very large positive number, not a very large negative
> number. Your result is right though, it approaches 0.
>
> This looks like a bandwidth filter to me. Did I guess right? If so, unless
> you're trying to improve it or pick the best filter you don't really need to
> know the exact shape, the important part is a rapid decrease once you get out
> of the bandwidth. So the general shape is 1 at the center, slowly decreasing
> to the band wanted (.5), followed by a rapid decrease towards 0. An ideal
> filter would be exactly 1 from [0,.5], and 0 from [.5,1]. You only get ideal
> ones with digital data though.
>
>
My appologies- right concept, wrong terminology. This is a low-pass filter.
Its late, sorry. It passes through all values with an m close to 0, and dumps
those beyond a certain m. As such, it should be a gradual decrease from (0,c)
where c is the cutoff value, and a rapid decrease from (c,1). Cutoff value is
somewhere not long after .5. A m of .7 makes f=sqrt(p), which if I remember is
generally where you consider the cutoff, although it's been a while since I've
done filters.
This makes sense as a blend function. Imagine m is the distance between 2
pixels. As m gets larger, the amount that second point counts into the blend
gets smaller and smaller, because log(.5)/log(m) becomes a higher positive
number (leading to a smaller result since p is less than 0). P is just the
pixel value of the second point. My guess is it runs this on a large number of
pixels and sums them to get the new value of the pixel its blending. Most
likely it takes the rgb (or cmy or whatever else it uses) and converts each
component to a value [0,1] and rune this equation on it. The only question is
how it gets m.
If you want to play with it, you can adjust how much further away pixels are
taken into account by changing the .5 (raising it to make it use them more,
lowering it for less). If you reverse the division, you get a highpass filter-
it accepts the pixels further away more and the ones closer to it less.
Expect wacky results if you use that, since the least relevant data will count
for the most in your blend. I wouldn't seriously use any hand rolled filter
though- it takes deep black magic to create a good one, you have to really
know what you're doing. Its a lot of tradeoffs between cutoff point, how well
the cutoff point works (how quickly it goes down after it), and how evenly the
values in the filter are counted.
Gabe
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list