🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.programmer.codewarrior
Article #654

Re: Red Eye Removing, How?

#654
From: Chris
Date: Tue, 21 Oct 2003 20:11
39 lines
2534 bytes
In article <7328a61a.0310101735.6ad75c32@posting.google.com>,
 heroin_c@hotmail.com (wall) wrote:

> Thanks Chris.
> But could you give me some code about this.My english is very poor,so
> I think maybe I can understand your idea from source code.

HI,
actually I don't have any code. that was just a general process I was 
describing. It might go something like this:

/* pass 1 -histogram red values */

UInt8 totals[256];
for( each pixel )
   r = (r value)
   totals[r]++

/* analyse histogram -find maximum drop off. this is very crude! */
/* you should definitely find a better way to find the level at */
/* which red eye is occurring. */
UInt32 threshold = 254;
Uint32 delta = 0;
for( i = 0; i < 254; i++ )
   if( delta < totals[i + 1] - totals[i] ) {
      delta = totals[i + 1] - totals[i];
      threshold = i;
      }

/* threshold contains the level at which redeye is deemed to be present*/

/* pass 2 -modify red values */
for( each pixel )
   r = (r value)
   if( r >= threshold )
      (r value) = (b value + g value) / 2

/* pass 2 discards red values over the threshold and replaces them
with the average of b and g */
Technical Details
Message-ID: <nospam-67D666.16110321102003@netnews.attbi.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.mathworks.com!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!rwcrnsc53.POSTED!not-for-mail
References: <7328a61a.0310092311.7ba03fa1@posting.google.com> <nospam-275090.11004510102003@netnews.attbi.com> <7328a61a.0310101735.6ad75c32@posting.google.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bcce,ac196c6d17a8acce
X-Google-Attributes: gid10bcce,public
X-Google-Thread: f98ee,ac196c6d17a8acce
X-Google-Attributes: gidf98ee,public
X-Google-Thread: 11100c,ac196c6d17a8acce
X-Google-Attributes: gid11100c,public
X-Google-Thread: f635e,ac196c6d17a8acce
X-Google-Attributes: gidf635e,public
X-Google-ArrivalTime: 2003-10-21 13:11:05 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.mathworks.com!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!rwcrnsc53.POSTED!not-for-mail
From: Chris <nospam@mindspring.com>
Newsgroups: comp.sys.mac.programmer.codewarrior,comp.os.ms-windows.programmer.tools.misc,codewarrior.mac,comp.sys.mac.programmer.tools
Subject: Re: Red Eye Removing, How?
References: <7328a61a.0310092311.7ba03fa1@posting.google.com> <nospam-275090.11004510102003@netnews.attbi.com> <7328a61a.0310101735.6ad75c32@posting.google.com>
User-Agent: MT-NewsWatcher/3.2 (PPC Mac OS X)
Message-ID: <nospam-67D666.16110321102003@netnews.attbi.com>
Lines: 39
NNTP-Posting-Host: 24.98.65.110
X-Complaints-To: abuse@comcast.net
X-Trace: rwcrnsc53 1066767064 24.98.65.110 (Tue, 21 Oct 2003 20:11:04 GMT)
NNTP-Posting-Date: Tue, 21 Oct 2003 20:11:04 GMT
Organization: Comcast Online
Date: Tue, 21 Oct 2003 20:11:04 GMT