Re: Rookie having problems with some filter code. Any help?
- From: jg.campbell.ng@xxxxxxxxx
- Date: 13 Dec 2005 11:44:49 -0800
Don Bruder wrote:
> Hi folks.
> As the subject line says, I'm a rookie when it comes to image
> processing. I've stumbled onto a few resources online, most notably
> Frederic Patin's paper titled "An Introduction to Digital Image
> Processing" (available at
> <http://www.gamedev.net/reference/programming/features/imageproc/> as of
> the time I write this), and that's given me a lot of the background info
> I need to hack together some basic image-handling routines, but I'm
> having troubles with the results coming out of them - Quite possibly due
> to the fact that I'm such a total greenhorn when it comes to writing
> code to do digital image processing.
>
> I'm not sure if the problems I'm having stem from me being so green at
> the subject, one or more errors in Frederic's paper and/or example code,
> artifacts of converting his code (originally written to target Windows
> by way of a library called "Allegro 4.0") so it can run on a Macintosh,
> my improperly "replacing" some of the Allegro routines with Mac-centric
> versions, a combination of all these factors, or something completely
> off the wall, but whatever the cause, it's clear to anyone taking even
> the most casual glance at the results that my code is failing miserably.
>
> The code in question (commented to the point of ridiculousness for this
> post, since I haven't got a clue who might read it and wonder what on
> earth it's trying to do) as well as a "raw" image and the results of
> shoving that image through my attempt at a matrix-convolution based
> sharpness filter, plus a link to Frederic's paper, can be seen here:
> <http://www.sonic.net/~dakidd/Filterproblems.html>
>
> If any of you have any suggestions for me as to how/why things are going
> bad, and/or how to fix them, I'd be thrilled to death to hear from you,
> either here on the group, or via email. (Just pay attention to my
> anti-spam measures, as noted in my .sig, if you try to relpy to me via
> email.)
>
> I'd also welcome any pointers to more and/or better info on coding
> digital image processing stuff, if anyone would care to point me in the
> right direction. (Please... Spare me the "google it" - I've been wearing
> out my eyeballs trying to figure out what is and isn't relevant in the
> literally millions of results google hands me)
>
> At this point, I just plain don't care how slow/inefficient/etc the code
> I'm working with may be - I can worry about optimizing it later - AFTER
> I've gotten it to the point where it's properly functional. I'm
> currently MUCH more interested in getting basic correct functionality
> out of it than any attempt at making it "the fastest, bestest, greatest
> filter ever written".
>
> Thanks in advance for any assistance you might be able to provide!
There's a lot more there than image processing.
1. For a start change
int sharpen_filter[sharp_w][sharp_h]={
{ 0,-1, 0},
{-1, 5,-1},
{ 0,-1, 0}
};
to
int sharpen_filter[sharp_w][sharp_h]={
{ 0,0, 0},
{0, 1,0},
{ 0,0, 0}
};
and you the output and input should be identical.
2. Print some numbers (a few, a very few) of in and out -- print the
first ten pixels of input and output of the tenth line in the image and
let us see that.
3. Just guessing, you are extracting 8-bit rs, gs and bs from the Color
pixel? And then constructing a Color pixel from the filtered result?
What is 0*0 -1*0 +0*0 -1*0 + 5* 200 -1*0, ...? Does it fit into eight
bits? If that is the case, I don't think 'Normalizer' is of much
assistance; it should be 1; incidentally, did you ever initialise it
before the summation?
Unless you know what you are doing, do image calculations in float or
double and *then* normalise and convert back to whatever.
Best regards,
Jon C.
.
- Follow-Ups:
- Re: Rookie having problems with some filter code. Any help?
- From: Don Bruder
- Re: Rookie having problems with some filter code. Any help?
- References:
- Rookie having problems with some filter code. Any help?
- From: Don Bruder
- Rookie having problems with some filter code. Any help?
- Prev by Date: Luminance and RGB layers question
- Next by Date: Re: Rookie having problems with some filter code. Any help?
- Previous by thread: Rookie having problems with some filter code. Any help?
- Next by thread: Re: Rookie having problems with some filter code. Any help?
- Index(es):
Relevant Pages
|