Strange problem when converting RGB to HSV

Posted by zaplec on Stack Overflow See other posts from Stack Overflow or by zaplec
Published on 2010-04-16T17:00:00Z Indexed on 2010/04/16 17:03 UTC
Read the original article Hit count: 253

Filed under:
|
|
|
|

Hi,

I made a small RGB to HSV converter algorithm with C. It seems to work pretty well, but there is one strange problem: If I first convert i.e. a 800x600 picture into HSV map and then back to RGB map without doing any changes in the values, I get some pixels that are convertet incorrectly. Then if I try to convert those misbehaving single pixels alone to and back, they're converted correctly. Any idea what could be the problem? I'm using Daniel Karlings PNGLite to open that PNG file.

Here are the source code of my main.c, rgbtohsv.c and rgbtohsv.h

rgbToHsv.h

rgbToHsv.c

pngmain.c

I linked pngmain only that if somebody wants to test and run this on his own system.

-zaplec

© Stack Overflow or respective owner

Related posts about c

    Related posts about png