filter.c gives a list of five filters types : hue_filter sat_filter val_filter contrast_ gradient_
The first thres types are "simple", one could say "of the first order": the deal with each pixel independently of its neighbours as well as of the image as a whole. The other types take into account, more or less, the environment.
Simple filters
hue_filter.c list the filtres operating mainly on the hues
violin_toning case 1001 : f( 39); break; //violin_toning
blue_toning1 case 1002 : f( 37); break; //blue_toning1
blue_toning2 case 1003 : f( 43); break; //blue_toning2
green toning case 1004 : f( 36); break; //green_toning
bronze_toning case 1005 : f( 44); break; //bronze_toning
greenish_toning case 1006 : f( 34); break; //greenish_toning
green_mauve_toning case 1010 : f( 38); break; //green_mauve_toning
reddish_toning case 1011 : f( 42); break; //reddish_toning
red_brown_toning case 1012 : f( 46); break ; //red_brown_toning
sepia_toning case 1014 : f( 31); break; //sepia_toning
graying case 1015 : f(8); break; //graying
smart_graying//case 4010 smart_graying
BW case 4008 BW
blacktocol case 1023 : f(16); break; //blacktocol
negative (or shortly n) inverses values and gives the complementary color
n case 3001 : F(9); break; //
nval case 3002 : FP1(5,0) ; break; //nval
hue_rotation operates (would do that if it worked correctly) a rotation in the hue space (see the chapter about colors), indicated by the number of degrees, for example 90 hue_rotation. Vous pouvez apprécier l'effet sur une image normale, mais on voit directemnet l'effet angulaire en chargeant color_wheel.
about BW, graying and smart_grayingsee the chapter about colors.
sat_filter.c :
-
saturation is slightly reduced by sat- more strongly with sat-- . You can trim the effet with a number followed by sat-num (maximum effect with 0 sat-num,
equivalent to graying)
- saturation is slightly augmented by sat+,
more strongly with sat++ ; and you can adjust as above with
sat+num (maximum effect wih 1000 sat+num)
val filter.c change the luminosity with darken darken+ lighten lighten+
contrast augments contrast
More complex filters
fuzz makes a light fuzzing; you can repeat the operation for example as a grassroot form of antialiasing. This operations does, on each pixel, the average with the neighbouring pixels.
ranfuzz is not formally a fuzzing algorithm. It replaces each pixel by another pixel in the images, drawn at random in a more or less wide square. The results are pleasant. It can be parametered by a number given before (10 by default); this number gives the size of the square side.
ranfuzzh and ranfuzzv apply the same operation, but only horizontally or vertically.
median also create some fuzziness, but more subtly: it takes for each pixel the median value in the rectangle surrounding this pixel. On simple images (got by draw square, for instance) the result if of little interest. But on real pictures, or mixing of pictures, if makes sometimes a very pleasant merging. It can be of use also before a segmentation.
medianNum : attemps to reach a given complexity by successive application of the median filter
All the filters above tend to smooth the image, to melt th pixels. The following ones, on the other hand, stenghten the differences;
sharpen gives a "sharper", "crisper" image. You can use it repeatedly, but the results become quire rapidly bizarre.
gradient replaces the images by the variations inside it; the result by itself is rarely pleasant, but gives useful bases tor other actinos. You can make it better with an additional sharpen
darken
gradient case 2004 : F(46); break; //gradient
skinning case 2005 : F(69); break; //skinning
contours. See the dedicated page.
pixelize : cuts images into small squares, computing the average color for each square
maxcut
___________________________________________________________________
gradation 'h', 'N', 50 case 1 : DegGenR();
//monochromes
simili case 1016 : f(25); f(1); break; //simili
simili2 case 1017 : f(25); f(9); break; //simili2
differpixel case 1018 : F(10); break; //differpixel (Gouchet Code)
pixiedust //case 1019 : pixieDust(); break; //pixiedust (Gouchet Code)
primerize case 1020 : Primerize(); break; //primerize (Gouchet Code)
redex case 1021 : f(61); break ; //redex
suppixels case 1022 : supPixels(); break ; //suppixels
Operational ?
watermark case 3003 : F(2); break ; //watermark
waterhide case 3004 : F(3); break ; //waterhide
watershow case 3005 : F(4); break ; //watershow
//fuzz, sharpen, poster
blur case 4000 : F(59); F(59); F(59); F(59); F(59); F(59); F(59); F(59); ; break; //blur
fuzz case 4001 : F( 59); break; //fuzz
ranfuzz case 4002 : number = max(10, number); Ranfuzz(refReg, number); break; //ranfuzz
ranfuzzh case 4003 : number = max(10, number); Ranfuzzh(refReg,number); break ;//ranfuzzh
ranfuzzv case 4004 : number = max(10, number); Ranfuzzv(refReg,number); break; //ranfuzzv
median case 4005 : F(61); break; //median . very interesting to reduce complexity
sharpen case 4006 : F(1); break; //sharpen
poster case 4007 : f( 25); break; //poster
pixelize case 4009 : Pixelize(number); break; //pixelize
smart_graying case 4010 : F(6); break; //smart_graying
ranfuzzn case 4011 : Ranfuzz(0, number); break ; //ranfuzzn on any number
limit_var case 4012 : f(60); break; //limit_var
median_num case 4013 : medianNum(number) ; break; //median_num
ameyed case 4014 : Ameyed(); break; //ameyed
reduce_num case 4016 : reduceNum(number) ; break; //reduce_num
augment_num case 4017 : augmentNum(number) ; break; //augment_num
target_num case 4018 : targetNum(number) ; break; //target_num
yellows_num case 4019 : yellowsNum(number) ; break; //yellows_num
ranfuzzm case 4020 : number = max(10,number); Ranfuzzm(refReg, number); break; //ranfuzsm
posterclass case 4021 : f(24); break; //posterclass
formsAddNum case 4030 : formsAddNum(number);
//hue changes
hue_rotation case 5001 : FP1(1, number) ; break; //(int) random(360)); break; //hue_rotation. beware, experimental changes in the filter
hue_variance case 5002 : FPN(2, 120, 170, 240, 190); break; //hue variance- (reduction (interesting ? )
cohen case 5003 : f(25) ; f(5); break; //cohen
helix_fcase 5004 : number = (int) random(360); f(7) ; break; //helix_f
shrink_f case 5005 : number = (int) random(360); f(27); break ; //shrink_f
melon_f case 5006 : f(28) ; break; //melon_f
plate_f case 5007 : f(29) ; break; //plate_f
plate_hf case 5008 : f(30); break; //plate_hf
refCol_f case 5009 : f(11); break; //refCol_f
filler case 5010 : f(13); break; //filler
pfiller case 5011 : paletteFiller(0); break; //pfiller
qfiller case 5012 : paletteFiller(1); break; //qfiller
rfillercase 5013 : paletteFiller(2); break; //rfiller
sfiller case 5014 : paletteFiller(3); break; //sfiller
tfiller case 5015 : break; //tubesetFiller(); break; //tfiller
helix_l case 5016 : number = (int) random(360); f(6) ; break; //helix_l
blacksupp case 5017 : number = max(number, 20); f(15); break; //blacksupp
palign case 5021 : paletteAlign(0); break; //palign
qalign case 5022 : paletteAlign(1); break; //qalign
valign case 5023 : paletteAlign(2); break; //valign
salign case 5024 : paletteAlign(3); break; //salign
talign case 5025 : break; //tubesetAlign(); break; //talign
hplane case 5031 : if ((number == 0)||(number>359)) number = 1 ; f(14); break; //hplane
hueprop case 5033 : FP1(21, 0); break; //hueprop
//saturation changes
sat- case 6001 : FP1(6, 700); break;//sat-
sat-- case 6002 : FP1(6, 500); break; //sat--
sat+ case 6003 : FP1(7, 300); break;//sat+
sat++ case 6004 : FP1(7, 500); break;//sat--
sat_variance case 6007 : FPN(3, 100, 400, 900, 600) ; break ; //sat_variance- saturation variance reduction (??
sat_neg case 6008 : f(12); break; //sat_neg
sat-num case 6009 : FP1(6, number); break; //sat-num
sat+num case 6010 : FP1(7, number); break; //sat+num
satprop case 6013 : FP1(22, 0); ; break; //satprop
//value changes, contrast
hue+4 case 6990 : FP1(11,0); break; //hue+4
sat-25 case 6991 : FP1(12,0); break; //sat-25
val-3 case 6992 : FP1(13,0); break; //val-3
darken case 7002 : FP1(2, 0); break; //darken ; the 0 has no meaning here
lighten case 7003 : FP1(3, 0); break; //lighten ; the 0 has no meaning here
lighten- case 7004 : FP1(13,0); break; //lighten-
contrast case 7005 : FPN(1, 50,10, 200, 240); break; //contrast
contrast2 case 7006 : FPN(1,50,30,150,220); break; //contrast2
contrast3 case 7007 : FP1(4, 50); break; //contrast3
bettercont case 7008 : //bettercont
valprop case 7011 : FP1(23,0); break; //valprop
case 7012 : Averagecolreg(refReg); break; //
resonance case 7013 : Resonance(); //reson
//gradations
//Deg(int regloc, char hsvparam, char dsens, char excep, int taux)
gradationll_X case 8001 : Deg(0, 'x' , 'X', 'u', number); break; //gradationll_X
gradationll_hue case 8002 : Deg(0, 'h', 'N', 't', number); break; //gradationll_hue
gradationll_sat case 8003 : Deg(0, 's', 'N', 't', number ) ; break; //gradationll_sat
gradationll_val case 8004 : Deg(0, 'v', 'N', 'u', number ) ; break; //gradationll_val
gradation_X case 8005 : Deg(refReg, 'x', 'X', 'u', number); break; //gradationl_X
gradation_hue case 8006 : Deg(refReg, 'h', 'N', 't', number); break; //gradationl_hue
gradation_sat case 8007 : Deg(refReg, 's', 'N', 't', number); break; //gradationl_sat
gradation_val case 8008 : Deg(refReg, 'v', 'N', 'u', number); break; //gradationl_val
gradation_X case 8011 : DegGen('X',195, 'X', 195, 'X', 195, 'u') ; break; //gradation_X
gradation_hue case 8012 : DegGen('N', number, 'N',0, 'N', 0, 'u'); break; //gradation_hue
gradation_sat case 8013 : DegGen('N',0, 'X', number, 'N', 0, 'u'); break; //gradation_sat
gradation_val case 8014 : DegGen('N', 0, 'N',0, 'X', number, 'u'); break; //gradation_val
gradationr_X case 8021 : DegGenReg('X',195, 'X', 195, 'X', 195, 'u') ; break; //gradationr_X
gradationr_hue hue case 8022 : DegGenReg('N', number, 'N', 0, 'N', 0, 'u') ; break; //gradationr_hue
gradationr-sat case 8023 : DegGenReg('N',0, 'N', number, 'N', 0, 'u') ; break; //gradationr_sat
gradationr-val case 8024 : DegGenReg('N',0, 'N', 0, 'N', number, 'u') ; break; //gradationr_val
gradation_country case 8031 : // gradation_country DegGenReg('N', 50, 'S', 30, 'N', 30, 'u');
gradationr_X case 8040 : DegGenReg('X',195, 'X', 195, 'X', 195, 'u') ; break; //gradationr_X
gradationC_sat case 8041 : if (number == 0) number = 20; DegGen('N',0, 'C', number, 'N', 0, 'u'); break; //gradationC_sat
gradationC_val case 8042 : if (number == 0) number = 20; DegGen('N',0, 'N', 0, 'C', number, 'u'); break; //gradationC_val
gradationC_sat case 8043 : if (number == 0) number = 20; DegGenReg('N',0, 'C', number, 'N', 0, 'u'); break; //gradationrC_sat
gradationC_val case 8044 : if (number == 0) number = 20; DegGenReg('N',0, 'N', 0, 'C', number, 'u'); break; //gradationrC_val
color_wheel //case 9000 : colorWheel(); break; //color_wheel
snow case 9001 : F(7); break; //snow<
General considerations about filters, see diccan.
The concept is very wide.
Simple filters are simplification, selection of elements
Complex filters can add.
Filters with memory
Filters operate on images.
Basically, they make them more simple. But some make them more "complex" (on the difg sense)
Some geometric operations (see next chapter) can also be considred as filters.
Most of the filters can be applied exclusively to a given region. Or successively to all the regions (in some cases that will be very different from an application to the whole image).
The original document
graying
smart_graying
blue_toning
negative
gradient
contours
etching
blur blur blur
ranfuzz
The code : Filters, Primerize An algorithm written by Xavier Gouchet
A filter applies always to a region (region default value, 0, is the whoe image)
Filters (at least those presented here) need no memory beyond their excution one time. Then the variables are local.
F() : a series of filters
f() : another series of filters, operating pixel by pixel on the displayed image, upon the HSV values, with conversion from the RGB
value of the pixel, and final restitution of the new RGB values.
FP1() : filters with one parameter
FPN() : filters with several (four) parameters