Article View: comp.sys.mac.programmer.codewarrior
Article #670Re: Red Eye Removing, How?
From: Chris
Date: Fri, 10 Oct 2003 15:00
Date: Fri, 10 Oct 2003 15:00
54 lines
3402 bytes
3402 bytes
In article <7328a61a.0310092311.7ba03fa1@posting.google.com>,
heroin_c@hotmail.com (wall) wrote:
> I use this code selected the rect which has red eyes.
>
> // the selected rect which has red eye
> // the selected image part GWorld - theSelectImageGWorld
> LGWorld* theSelectImageGWorld = NEW LGWorld( theSelectRect,32 );
> ThrowIfNil_( theSelectImageGWorld );
>
> // the orignal image GWorld - theImageGWorld
> PixMapHandle theOPixMapH = ::GetGWorldPixMap(
> theImageGWorld->GetMacGWorld() );
> PixMapHandle theSelectPixMapH = ::GetGWorldPixMap(
> theSelectImageGWorld->GetMacGWorld() );
> Ptr theOBaseAddr = ::GetPixBaseAddr( theOPixMapH );
> Ptr theSelectBaseAddr = ::GetPixBaseAddr( theSelectPixMapH );
> short theORowBytes = ::GetPixRowBytes( theOPixMapH );
> short theSelectRowBytes = ::GetPixRowBytes( theSelectPixMapH );
>
> ::LockPixels( theOPixMapH );
> ::LockPixels( theSelectPixMapH );
> {
> Ptr theSrcPtr, theDstPtr;
> for(short theY = mSelRectToImageOrignal.top; theY <
> mSelRectToImageOrignal.bottom; theY++)
> {
> theSrcPtr = theOBaseAddr + theORowBytes * theY;
> theSrcPtr += mSelRectToImageOrignal.left << 2;
> theDstPtr = theSelectBaseAddr + theSelectRowBytes * ( theY -
> mSelRectToImageOrignal.top );
> for (short theX = mSelRectToImageOrignal.left; theX <
> mSelRectToImageOrignal.right; theX++)
> {
> * ((long*) theDstPtr++) = * ((long*) theSrcPtr++);
> * ((long*) theDstPtr++) = * ((long*) theSrcPtr++);
> * ((long*) theDstPtr++) = * ((long*) theSrcPtr++);
> * ((long*) theDstPtr++) = * ((long*) theSrcPtr++);
>
> }
> }
> }
> ::UnlockPixels( theOPixMapH );
> ::UnlockPixels( theSelectPixMapH );
>
> what can I do to removing red eye in the selected image part?
I should add that you may want to leave a pixel alone if its red value
does not exceed some high threshold. This will prevent discolration of
the iris's inside the boundary. You could precalculate the threshold by
histogramming the contents and looking for a sharp increase in the value
of the red channel. Or you could use a fixed value.
Chris.
Technical Details
Message-ID:
<nospam-275090.11004510102003@netnews.attbi.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.mathworks.com!wn13feed!wn11feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!sccrnsc02.POSTED!not-for-mailReferences:
<7328a61a.0310092311.7ba03fa1@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: 11100c,ac196c6d17a8acce X-Google-Attributes: gid11100c,public X-Google-Thread: f98ee,ac196c6d17a8acce X-Google-Attributes: gidf98ee,public X-Google-Thread: f635e,ac196c6d17a8acce X-Google-Attributes: gidf635e,public X-Google-ArrivalTime: 2003-10-10 08:00:46 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.mathworks.com!wn13feed!wn11feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!sccrnsc02.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> User-Agent: MT-NewsWatcher/3.2 (PPC Mac OS X) Message-ID: <nospam-275090.11004510102003@netnews.attbi.com> Lines: 54 NNTP-Posting-Host: 24.98.65.110 X-Complaints-To: abuse@comcast.net X-Trace: sccrnsc02 1065798045 24.98.65.110 (Fri, 10 Oct 2003 15:00:45 GMT) NNTP-Posting-Date: Fri, 10 Oct 2003 15:00:45 GMT Organization: Comcast Online Date: Fri, 10 Oct 2003 15:00:45 GMT