Talk:Color presets

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(Raffriff42 please read)
 
m (Category:Talk)
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
[[Category:Talk]]
 
@Raffriff42,
 
@Raffriff42,
  
 
I don't know what formula's you used to calculated the HSL values but they seem to be wrong.
 
I don't know what formula's you used to calculated the HSL values but they seem to be wrong.
 
[http://en.wikipedia.org/wiki/HSL_and_HSV Wikipedia] contains the formula's where 0<=H<360.0, 0<=S<=1 and 0<=L<=255.
 
[http://en.wikipedia.org/wiki/HSL_and_HSV Wikipedia] contains the formula's where 0<=H<360.0, 0<=S<=1 and 0<=L<=255.
I suggest you use those. Example:
+
I suggest you use those. Example (color_blueviolet):
  
R = 138
+
R = 138 <br>
G = 043
+
G = 043 <br>
B = 226
+
B = 226 <br>
M = max(R,G,B) = 226
+
M = max(R,G,B) = 226 <br>
m = min(R,G,B) = 43
+
m = min(R,G,B) = 43 <br>
C = M - m = 183
+
C = M - m = 183 <br>
B = M => H = 60*(4+(R-G)/C) = 60*(4+(138-43)/183) = 271.15
+
B = M => H = 60*(4+(R-G)/C) = 60*(4+(138-43)/183) = 271.15 <br>
L = (M+m)/2 = 134.5
+
L = (M+m)/2 = 134.5 <br>
S = C/(255-|2*L-255|) = 183/(255-|2*134.5-255|) = 0.76
+
S = C/(255-|2*L-255|) = 183/(255-|2*134.5-255|) = 0.76 <br>
 +
 
 +
Also you should add an appropriate reference for this. [[User:Admin|Admin]] 00:18, 19 August 2014 (CEST)
 +
 
 +
:Sure thing, I created RGB '''BlankClip'''s with the values from '''colors_rgb.avsi''', converted to YV12 with matrix="PC.601", and calculated hue as
 +
 
 +
::[http://forum.doom9.org/showthread.php?p=1670625#post1670625 atan2](VPlaneMedian-128, UPlaneMedian-128)*180/PI + 360) % 360
 +
 
 +
:My complete script is posted here: [https://dl.dropboxusercontent.com/u/108089426/Code/avisynth-Colors%7E2.avs] [[User:Raffriff42|Raffriff42]] 15:31, 19 August 2014 (CEST)
 +
 
 +
::The values you posted stand for hue, saturation and luma derived of the YCbCr colorspace (you should have converted to yv24 instead). I suggest you name it (HSL)_ycbcr or something like that. Since the colorpresets are given in rgb values it would make more sense to include (HSL)_rgb instead. [[User:Admin|Admin]] 16:04, 19 August 2014 (CEST)
 +
 
 +
:::Added a boxed note. What do you think? [[User:Raffriff42|Raffriff42]] 19:57, 19 August 2014 (CEST)
 +
 
 +
::::The hue and saturation values you give are a YCbCr concept while the color presets are given as RGB. I suggest you add the HSV and HSL values instead. That will be more useful to people. [[User:Admin|Admin]] 23:18, 21 August 2014 (CEST)
 +
 
 +
:::::I have made the requested changes. [[User:Raffriff42|Raffriff42]] 08:32, 22 August 2014 (CEST)

Latest revision as of 02:02, 14 December 2015

@Raffriff42,

I don't know what formula's you used to calculated the HSL values but they seem to be wrong. Wikipedia contains the formula's where 0<=H<360.0, 0<=S<=1 and 0<=L<=255. I suggest you use those. Example (color_blueviolet):

R = 138
G = 043
B = 226
M = max(R,G,B) = 226
m = min(R,G,B) = 43
C = M - m = 183
B = M => H = 60*(4+(R-G)/C) = 60*(4+(138-43)/183) = 271.15
L = (M+m)/2 = 134.5
S = C/(255-|2*L-255|) = 183/(255-|2*134.5-255|) = 0.76

Also you should add an appropriate reference for this. Admin 00:18, 19 August 2014 (CEST)

Sure thing, I created RGB BlankClips with the values from colors_rgb.avsi, converted to YV12 with matrix="PC.601", and calculated hue as
atan2(VPlaneMedian-128, UPlaneMedian-128)*180/PI + 360) % 360
My complete script is posted here: [1] Raffriff42 15:31, 19 August 2014 (CEST)
The values you posted stand for hue, saturation and luma derived of the YCbCr colorspace (you should have converted to yv24 instead). I suggest you name it (HSL)_ycbcr or something like that. Since the colorpresets are given in rgb values it would make more sense to include (HSL)_rgb instead. Admin 16:04, 19 August 2014 (CEST)
Added a boxed note. What do you think? Raffriff42 19:57, 19 August 2014 (CEST)
The hue and saturation values you give are a YCbCr concept while the color presets are given as RGB. I suggest you add the HSV and HSL values instead. That will be more useful to people. Admin 23:18, 21 August 2014 (CEST)
I have made the requested changes. Raffriff42 08:32, 22 August 2014 (CEST)
Personal tools