🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #799

Trouble with scaling of PGM file...

#799
From: Sandee Padua
Date: Wed, 02 Dec 1998 00:00
44 lines
3396 bytes
I must say that I'm a 47 year old mother who has recently started
programming just for fun.  I must say that I've watched these newsgroups
for a while, and am amazed at the quality of responses people receive.
Maybe someone can help me now?  Below is a description of how the
program should work and my algorithms for scaling and histogram
enhancement.

I'm working on a program (for fun) that will take a PGM (in ASCII) file
and do some histogram and scaling enhancements.  The interface will be
command line looking something like %PGMenhance -<flag> <pgmfilename>
where the flags are u: prints a short "help" description.
h: applies a histogram enhancement
s: applies a scaling enhancement

Here are a couple things I'm assuming:

-> Input files will be ASCII PGM (P2) format, 256 levels of gray.
-> Input images will not have more than 64,000 pixels of any particular
gray level.

Here's some definitions:

-> Scaling enhancement is performed as follows.  Let MIN and MAX be the
smallest and largest pixel values, respectively.  Modify each pixel, P,
as follows:
    P = (P-MIN)*(256/(MAX-MIN))

-> Histogram enhancement is performed as follows.  Compute the number of
pixels having each gray level from zero to 255.  Let T be the total
number of pixels, and N[I] be the number of pixels at gray level I.
Modify each pixel value P as follows:
    P=P*(1/T)*SUM(N[0],....,N[P])

I'm really lost on how to start a program like this....remember I am a
beginner.  I found this problem while surfing around the net and thought
I'd give it a try.  I'm currently working on the code, and would
appreciate some people's input on how to implement this program and
possibly some code example.

Thanks for your time and patience,

Sandee
-- 
comp.lang.c.moderated - clcm@plethora.net
Technical Details
Message-ID: <clcm-19981202-0025@plethora.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fdcad,e2cd68c9f3cf5729,start
X-Google-Attributes: gidfdcad,public
X-Google-Thread: 1014db,e2cd68c9f3cf5729,start
X-Google-Attributes: gid1014db,public
X-Google-Thread: 1123d7,e2cd68c9f3cf5729,start
X-Google-Attributes: gid1123d7,public
X-Google-Thread: 10c73c,e2cd68c9f3cf5729,start
X-Google-Attributes: gid10c73c,public
X-Google-Thread: 109fba,e2cd68c9f3cf5729,start
X-Google-Attributes: gid109fba,public
X-Google-Thread: 100850,e2cd68c9f3cf5729,start
X-Google-Attributes: gid100850,public
X-Google-Thread: 114592,e2cd68c9f3cf5729,start
X-Google-Attributes: gid114592,public
X-Google-Thread: f9822,e2cd68c9f3cf5729,start
X-Google-Attributes: gidf9822,public
From: Sandee Padua <angels3@lightspeed.net>
Subject: Trouble with scaling of PGM file...
Date: 1998/12/02
Message-ID: <clcm-19981202-0025@plethora.net>
X-Deja-AN: 417952632
X-Old-trace: nntp.csufresno.edu 912554283 1350 129.8.215.22 (1 Dec 1998 23:18:03 GMT)
Content-Transfer-encoding: 7bit
Approved: clc@plethora.net
X-Accept-language: en
Content-Type: text/plain; charset=us-ascii
X-Trace: ptah.visi.com 912627769 205.166.146.1 (Wed, 02 Dec 1998 13:42:49 CDT)
Organization: California State University, Fresno
X-Old-complaints-to: abuse@csufresno.edu
Mime-Version: 1.0
NNTP-Posting-Date: Wed, 02 Dec 1998 13:42:49 CDT
Newsgroups: alt.comp.lang.learn.c-c++,comp.lang.c,comp.lang.c.moderated,comp.lang.c++,de.comp.lang.c,de.comp.lang.c++,fr.comp.lang.c,fr.comp.lang.c++
Originator: clcm@plethora.net (comp.lang.c.moderated)