How does Brightness,Contrast, Hue, Saturation, actually work?

I have attached the file of image processing application for iphone. Each of the cases(Brightness , Hue , Saturation..etc) are calling some other functions can some one please explain to me  how they are doing the required process.  Which algorithm or how the brightness or hue or saturation actually changing in this following application. They are in the function viewDidLoad in the file ViewController.m.
I have included all the files including the header files. So all the functions it is calling are present in the given project folder.

Link to File:
pass : imageprocess
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brightness and contrast control the non color functions of a image. That is,..brightness is how bright and contrast is a ratio of full bright to full dark and can vary how dark a contrast between bright and dark really are.

Hue is the color temperture or tinge and can adjust, say,..  pink, to get darker till it becomes almost red... leave this one alone in most cases as the manufacturer has this preset...  Saturation is the intensity of the color/s itself.

Most of these settings are fixed with the exception of brightness and possibly contrast on things like a mobile phone.  Try using the default settings in your program and test only one of them at a time.  If you don't know what the default settings are, look at the help files and use the center range of adjustment.  If you can't find the range of numbers then just make a guess and test it to see what happens. Most compilers or run time debuggers will tell you if the range is correct or not.
I do not have any example for iPhone.
I've tried to download the zip-file you posted - I cannot open this zip-file on Mac.

Here is few useful links - it is about Windows and C#, but the algorithms will be the same in Objective-C too.

Adjusting The Contrast Of An Image.

CodeProject. Image Processing for Dummies with C# and GDI+ Part 1 - Per Pixel Filters

In the last CodeProject article you will find a very simple explanation about the brightness and contrast (other filters) too.
Same in C++
CodeProject. Image Processing Using GDI+

It is again about Windows programming, but the algorithms are the same.

C++ works fine on iPhone.
HBITMAP, other GDI calls should be replaced.

Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

sanghai45Author Commented:
kindly use the software called "The Unarchiver" for extracting the file.
I asked two of my friends to test it on macs and it works.
password : imageprocess

link for The Unarchiver :
Thanks. I've downloaded. It is an iPhone application that uses OpenGL - simple and standard OpenGL code if in image.c file. It is a very nice implementation. This code can be re-used in any application and for any platform.

The main functions are:
static void brightness(V2fT2f *quad, float t)      // t [0..2]
static void contrast(V2fT2f *quad, float t)      // t [0..2]
static void greyscale(V2fT2f *quad, float t)      // t = 1 for standard perceptual weighting
static void extrapolate(V2fT2f *quad, float t)      // t [0..2]
static void blur(V2fT2f *quad, float t)      // t = 1

This is the Apple source code. The theory you get here:

OpenGL in Mac Reference Library:

I'd begin from these simple articles on CodeProject:
CodeProject. Image Processing for Dummies with C# and GDI+ Part 1 - Per Pixel Filters

CodeProject. Image Processing Using GDI+

Then with OpenGL on Mac.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sanghai45Author Commented:
Could you please look into the file viewcontroller.m and explain to me how exactly each of those are working... Like how the brightness is actually being changed... And so on..
Ok. Let's try.

1. Let's beging from the MainViewController. In the implementation file you can find few classical implementations - how to choose an image file on iPhone, and then how to scale it. This last function is implemented in:
- (UIImage *)scaleAndRotateImage:(UIImage *)image

Everything used in this method is pure Cocoa - detect the image size, detect the screen size, use Affine transformation to scale the image correctly and draw it on the graphic context.

Maybe this is a central method in this program.

2. ViewController. You probably asked about these few buttons Brightness, Contrast, Saturation, Hue and Sharpness.
The image is:
UIImage *imageValue;
It is a static variable in this file together with io (UIImageView*).

These buttons are drawn on the screen.
You can save and send an image via email.

This file does not contain the algorithms.

3. The important code is in folder Classes. The functions that are interesting for you are in imaging.c file.
These files are taken from Apple dev resources. These are C and OpenGL code as I've told you. All work is done by OpenGL and I have nothing to comment here - these are the standard algorithms and I have posted the links explained the theory. These function like brightness are called from drawGL function as filters applied to the texture. This drawGL method is called from drawView from EAGLView class. There is "mode" variable in the parameters - this variable sets which filter will be used - brightness, contrast, etc. After the rendering (applying a filter to the texture) the image (the pixels) are copied onto the image that will be shown on the screen. The size of the result image is hardcoded (320x480).

It is a small and interesting program.

sanghai45Author Commented:
Dude we are gettting problem while applying brightness , hue, saturation etc... I mean to say if i took image nd applied brightness now if i want to change contrast and go on tab of contrast at the same time . My image gets refresh ie. Original image. Conclusion, I am not able to change brightness , contrast , hue at the same time on one image. If i changed brightness i  need to save it first then i need to upload the changed image then i can go for contrast etc...

ANother problem is when i upload the changed image or any image from library it gets stretched.

Can u  help us out with this two problems....Urgently please

>>to change brightness , contrast , hue at the same time on one image
In the code you posted all these algorithms were in the different functions. It is not a trivial thing to combine all of them in one function. If you need to call three function one by one, you can modify that code - make new functions -almost the same as you have but without the refreshing. Add new button to that app and make the change under this button.
sanghai45Author Commented:
Can u edit it and give it please...the problem is we have project presentation tmrw and we need to do other documents stuff also . i know this is something i m givng my project work to u but it will be very helpful to us if u will do the needful ..if u cant then also its fine for your precious time u have helped us a lot...

THanks a lot ...

Sorry, if you wish you can ask a related question here or ask a freelancer. Unfortunately, I'm busy with my own projects and in the evening I have no power to get in into this project.
sanghai45Author Commented:
Its fine dude ...thanks ..for ur precious time
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.