# Category : Files from Magazines

Archive : CUJ9306.ZIP

Filename : 1106082A

*

* find_cutoff_point(..

*

* This function looks at a histogram

* and sets a cuttoff point at a given

* percentage of pixels.

* For example, if percent=0.6, you

* start at 0 in the histogram and count

* up until you've hit 60% of the pixels.

* Then you stop and return that pixel

* value.

*

********************************************/

find_cutoff_point(histogram, percent, cutoff)

unsigned long histogram[];

float percent;

short *cutoff;

{

float fd, fsum, sum_div;

int i, looking;

long lc, lr, num=0, sum=0;

sum = 0;

i = 0;

lr = (long)(ROWS);

lc = (long)(COLS);

num = lr*lc;

fd = (float)(num);

while(looking){

fsum = (float)(sum);

sum_div = fsum/fd;

if(sum_div >= percent)

looking = 0;

else

sum = sum + histogram[i++];

} /* ends while looking */

if(i >= 256) i = 255;

*cutoff = i;

printf("\nCutoff is %d sum=%ld", *cutoff, sum);

} /* ends find_cutoff_point */

Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/