History
10/09/2002: Created HP of english version
05/09/2002: Modified CLASS structures in the Java program
29/08/2002: Fixed minor bugs in the Java program
25/08/2002: Developed a Java program
28/05/2002: Developed the algorithm
INDEX
Introduction
I love riding bike and taking pictures along cyclings. I usualy take pictures with a digital camera since it is easy to put them on HP, however, they are something wrong; all of them do NOT show vivid colors I have seen actually. To recover the colors I have tried many Retouch Softwares, but, they are all craps! Are people really using such that stupid softwares and satisfied with them?
I did NOT! Absolutely NOT!! So, I decided to develop a retouch algorithm myself. Although I spent only two days to finish, the algorithm seems to be working very nicely.
All copyrights of the algorithm belong to Hiroyuki Toyozumi and the scope of the rights is as written below. Using the algorithm is free in any forms and any methods. I am very appreciated if you write me before you use it.
Over View of the Algorithm
The basic idea is:
To satisfy above four constraints, I designed following algorithm. I explain only for the blue color retouch case.

r, g and b are the values of the red, green and blue components in a pixel respectively, and
is a value of b component after a retouch. r, g, and b are supposed to take a real value from 0.0 to bmax.
is forcibly set bmax when it exceeds bmax. s is a representative value for other than blue color, β is the ratio of blue component to the representative value for other than blue color, and X is a ratio (0.0<X<1.0) of blue component to the possible maximum value (bmax). Y is a special function whose value varies as following figure depending on β.

The Y controls the strength of a retouch and is the most important part of the algorithm. The point of the function is that it varies as b/s at around β<1.0, and that it gets flatter when β>1.0. The fact that Y never exceeds 2.0 whatever β takes restraints too strong modification of colors.
After a glance, it is apparent that X owes a condition lighter color in the constraint 2. and b>F2s carries the constraint 3.
There are three factors: 1.5, F1, F2, in the formula. The factor 1.5 is introduced so that F1 can work properly in the range from 0.0 to 1.0. F1 defines the strength of a retouch and should work even when it is less than 0.0 or greater than 1.0. F2 defines a condition only bluer pats in the constraint 3. and controls a minimum value, which limits the effect of a retouch, for each color components. The possible value is from 0.0 to 1.0 and the less value it is the more widely the retouch works because the limitation goes down.
The algorithm can be applied to red and green colors with permutations of variables r, g, b cyclically.
Sample Images
Following images show how the retouch works depending on F1 where F2 is set 0.8 for all cases.
Please note that detail pattern of clouds and waves remain even after the strongest retouch with F1=1.0.
![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() |
Following images are samples applied to darker blue colors.
F1=0.6 | |
|---|---|
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
Following samples are for other than blue color.
F1=0.4 | |
|---|---|
![]() | ![]() |
F1=0.5 | |
|---|---|
![]() | ![]() |
Further more, the algorithm permits performing retouch on each color almost independently. Following sample shows the case applying red and blue retouch simultaneously.
F1(Blue)=0.6 F1(Red)=0.35 | |
|---|---|
![]() | ![]() |
Java Program
I have developed a Java program to test the algorithm easily with GUI. I am a beginner of Java program and I know the classification of Classes is totally stupid. So, please do NOT send email about the stupidity.
The Java program also has a function to modify intensity automatically using Histogram Equalization Method. It seems to be working in general cases well. However, there are some cases that it causes terrible effect depending on the original intensity distribution of images.
There is a different point in the Java program from the explanation of the algorithm: the range of F1 and F2. In the Over View of the Algorithm, it is written that F1 and F2 vary from 0.0 to 1.0, however, in the Java program, they vary from 0 to 100 using slider objects. They are simply 100 times of the original values and the functions are exactly same. Additionally, F1 can be varied from -100 so that not only the increasing but also the decreasing color components can be done.
The distribution and use of the software is free in any forms and any methods. I am very appreciated if you write me after you download it.
Finally, I am sorry that the program only can handle JPEG images.
Download of the Program
To download, .... click!!
The main class is RGBRetouch.class, and start the program as
Screen Shots
![]() |
![]() |
![]() |