Category : Files from Magazines
Archive   : CUJ9306.ZIP
Filename : 1106082A

 
Output of file : 1106082A contained in archive : CUJ9306.ZIP
/*******************************************
*
* 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 */



  3 Responses to “Category : Files from Magazines
Archive   : CUJ9306.ZIP
Filename : 1106082A

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

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

  3. 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/