Strange problem when converting RGB to HSV
- by zaplec
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