PDA

View Full Version : OpenGL RGB to HSV homework (coded with C)



Zachary A.
01-04-2014, 06:29 AM
Hi guys and happy new year!
This is my first time here and I'm kind of in an emergency situation with some homeworks I had to do for a few weeks already. I must work on a picture with the ".bmp" format and using only C code and standard libraries of Linux + OpenGL, Glu & Glut.

The homeworks is about modifying a picture but by "windows" of little squares made of 3x3 or 4x4 or 6x6 or even 10x10 pixels, I'd start with an RGB conversion to the HSV and then I'd have to manage to analyze only the top left corner's square of 6x6 pixel (for instance) of the picture and change some pixel's positions and disposition according to their luminosity or their contrast... And then do the same thing with the next square, each pixel must be used only once of course, and repeat this until the whole picture has been modified...

Here's my problem, I know how to convert RGB to HSV, and I feel like it'd be easy to changes the positions of pixels according to luminosity etc but I have absolutely no clue of how I must proceed to analyze the picture square by square, I mean how do I "cut" what I'm working on in the 4x4 first pixel then the 4x4 next one etc...

If anyone could lend me a hand here, I'd greatly appreciate it !

tonyo_au
01-04-2014, 08:13 PM
Rule number 1 - we don't do people's homework; we respond to specific questions.

You question on converting RGB to HSV you can look at http://en.literateprograms.org/RGB_to_HSV_color_space_conversion_%28C%29 or just google "RGB to HSV".