Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
#1 | Link |
|
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,676
|
YUV color picker?
Hi,
I was wondering if someone knows of a YUV color picker that can correctly tell you the hex value for a color in the 601/709 (TV and PC range)? Something like this but in YUV: http://www.w3schools.com/tags/ref_colorpicker.asp I know AvsPmod displays YUV values but it does not have a color picker. There's the also the color presets page in the wiki but colors are for RGB. Edit: Blankclip has the color_yuv parameter but what is it based on? 601 or 709? Last edited by Reel.Deel; 24th February 2015 at 15:35. |
|
|
|
|
|
#2 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,392
|
Googled "color picker yuv", seems no shortage of choice
1st on list http://stnsoft.com/DVD/color_pick.html
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
|
|
|
|
|
#3 | Link |
|
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,676
|
Yeah, I saw that page while searching yesterday but what gets me is the slight color difference when using a 709 matrix. So I was looking for a something similar to that can tell me the correct value based on the matrix that I want to use.
|
|
|
|
|
|
#4 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,392
|
This any good to you ?
EDIT: Take 3 Code:
Function RGB_2_YUV(Int RGB_Color,String Matrix) {
RGB_Color=RT_BitAnd(RGB_Color,$FFFFFF)
BlankClip(Width=16,Height=16,Length=1,Color=RGB_Color)
c=ConvertToYV12(matrix=matrix)
current_frame=0
Y=c.YPlaneMin() U=c.UPlaneMin() V=c.VPlaneMin()
Col = (((Y*256)+U)*256)+V
return Col
}
RGB=$FFFFFF
Matrix= "Rec601" # "Rec601", "Rec709", "PC601", "PC709"
YUV=RGB_2_YUV(RGB,Matrix)
SRGB=RT_Hex(RGB,6)
SYUV=RT_Hex(YUV,6)
Messageclip("RGB = $"+SRGB+" : YUV=$"+SYUV + " (Matrix="+Matrix+")")
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 25th February 2015 at 00:19. |
|
|
|
|
|
#5 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,392
|
Or this
Code:
Matrix = "Rec601" # "Rec601", "Rec709", "PC601", "PC709"
ColorsRGB = "colors_rgb.avsi"
ColorsYUV = "colors_yuv_"+Matrix+".avsi"
Assert(Exist(ColorsRGB),ColorsRGB+" Does not exist")
Exist(ColorsYUV) ? RT_FileDelete(ColorsYUV) : NOP
PAD = 40
INSERT=RT_String("(yuv values [Matrix='%s'])",Matrix)
GSCript("""
TEXT=RT_ReadTxtFromFile(ColorsRGB)
LINES=RT_TxtQueryLines(TEXT)
for(i=0,LINES-1) {
S=RT_TxtGetLine(TEXT,i)
S=(S!="")?RT_StrReplaceDeep(RT_StrReplace(S,Chr(9)," ")," "," "):S
S=(S!="")?RT_StrReplace(S,"(rgb values)",INSERT):S
While(RT_Ord(S)==32) {S=MidStr(S,2)}
if(RT_Ord(S)==RT_Ord("#") || RT_Ord(S)==0) {
S=(RT_Ord(S)==0)?Chr(10):S
RT_WriteFile(ColorsYUV,"%s",S,Append=True)
} Else {
Hx = RT_FindStr(S,"= $")
Assert(Hx!=0,"Cannot find Dollar")
SOUT=RT_StrReplace(LeftStr(S,Hx-1),"color_",Matrix+"_",sig=false)
SOUT=RT_StrPad(SOUT,40)
RGB=RT_HexValue(S,pos=Hx+3)
YUV=RGB_2_YUV(RGB,Matrix)
RT_Writefile(ColorsYUV,"%s= $%0.6X # RGB = $%0.6X",SOUT,YUV,RGB,Append=True)
}
}
""")
return MessageClip("Done")
Function RGB_2_YUV(Int RGB_Color,String Matrix) {
RGB_Color=RT_BitAnd(RGB_Color,$FFFFFF)
BlankClip(Width=16,Height=16,Length=1,Color=RGB_Color)
c=ConvertToYV12(matrix=matrix)
current_frame=0
Y=c.YPlaneMin() U=c.UPlaneMin() V=c.VPlaneMin()
Col = (((Y*256)+U)*256)+V
return Col
}
Convert Colors_rgb_avsi to YUV file using chosen matrix. Results: colors_yuv_Rec601.avsi Code:
# list of common colors (yuv values [Matrix='Rec601']) # source: # http://en.wikipedia.org/wiki/List_of_colors # http://en.wikipedia.org/wiki/X11_color_names # http://www.cryer.co.uk/resources/javascript/html2.htm global Rec601_aliceblue = $E4847C # RGB = $F0F8FF global Rec601_antiquewhite = $DC7588 # RGB = $FAEBD7 global Rec601_aqua = $AAA610 # RGB = $00FFFF global Rec601_aquamarine = $C6804B # RGB = $7FFFD4 global Rec601_azure = $E78279 # RGB = $F0FFFF global Rec601_beige = $E07582 # RGB = $F5F5DC global Rec601_bisque = $D86E8E # RGB = $FFE4C4 global Rec601_black = $108080 # RGB = $000000 global Rec601_blanchedalmond = $DC708B # RGB = $FFEBCD global Rec601_blue = $29F06E # RGB = $0000FF global Rec601_blueviolet = $5FC29D # RGB = $8A2BE2 global Rec601_brown = $546EB6 # RGB = $A52A2A global Rec601_burlywood = $B36594 # RGB = $DEB887 global Rec601_cadetblue = $888A64 # RGB = $5F9EA0 global Rec601_chartreuse = $B1235A # RGB = $7FFF00 global Rec601_chocolate = $7E50B3 # RGB = $D2691E global Rec601_coral = $9958BC # RGB = $FF7F50 global Rec601_cornflowerblue = $8CAE64 # RGB = $6495ED global Rec601_cornsilk = $E47385 # RGB = $FFF8DC global Rec601_crimson = $5874D5 # RGB = $DC143C global Rec601_cyan = $AAA610 # RGB = $00FFFF global Rec601_darkblue = $1EBD76 # RGB = $00008B global Rec601_darkcyan = $649543 # RGB = $008B8B global Rec601_darkgoldenrod = $84439F # RGB = $B8860B global Rec601_darkgray = $A18080 # RGB = $A9A9A9 global Rec601_darkgreen = $42635B # RGB = $006400 global Rec601_darkkhaki = $A75E88 # RGB = $BDB76B global Rec601_darkmagenta = $41A8B3 # RGB = $8B008B global Rec601_darkoliveGreen = $60697B # RGB = $556B2F global Rec601_darkorange = $9831BD # RGB = $FF8C00 global Rec601_darkorchid = $64B4A2 # RGB = $9932CC global Rec601_darkred = $346BBD # RGB = $8B0000 global Rec601_darksalmon = $A367A6 # RGB = $E9967A global Rec601_darkseaGreen = $A1736F # RGB = $8FBC8F global Rec601_darkslateBlue = $4FA17F # RGB = $483D8B global Rec601_darkslateGray = $4C8572 # RGB = $2F4F4F global Rec601_darkturquoise = $8CA025 # RGB = $00CED1 global Rec601_darkviolet = $4BC7B2 # RGB = $9400D3 global Rec601_deeppink = $6A95DE # RGB = $FF1493 global Rec601_deepskyblue = $89B828 # RGB = $00BFFF global Rec601_dimgray = $6A8080 # RGB = $696969 global Rec601_dodgerblue = $79C246 # RGB = $1E90FF global Rec601_firebrick = $526BBF # RGB = $B22222 global Rec601_floralwhite = $E77B83 # RGB = $FFFAF0 global Rec601_forestgreen = $626159 # RGB = $228B22 global Rec601_fuchsia = $6ACADE # RGB = $FF00FF global Rec601_gainsboro = $CD8080 # RGB = $DCDCDC global Rec601_ghostwhite = $E68380 # RGB = $F8F8FF global Rec601_gold = $BE1CA1 # RGB = $FFD700 global Rec601_goldenrod = $9E3EA1 # RGB = $DAA520 global Rec601_gray = $7E8080 # RGB = $808080 global Rec601_green = $515B51 # RGB = $008000 global Rec601_greenyellow = $C2316B # RGB = $ADFF2F global Rec601_honeydew = $E67C7A # RGB = $F0FFF0 global Rec601_hotpink = $988BBD # RGB = $FF69B4 global Rec601_indianred = $7C6FB2 # RGB = $CD5C5C global Rec601_indigo = $30AE98 # RGB = $4B0082 global Rec601_ivory = $EA7981 # RGB = $FFFFF0 global Rec601_khaki = $CF578B # RGB = $F0E68C global Rec601_lavender = $D7897F # RGB = $E6E6FA global Rec601_lavenderblush = $E28086 # RGB = $FFF0F5 global Rec601_lawngreen = $AF245A # RGB = $7CFC00 global Rec601_lemonchiffon = $E46C85 # RGB = $FFFACD global Rec601_lightblue = $C08D6C # RGB = $ADD8E6 global Rec601_lightcoral = $9B6FB1 # RGB = $F08080 global Rec601_lightcyan = $E38572 # RGB = $E0FFFF global Rec601_lightgoldenrodyellow = $E36E83 # RGB = $FAFAD2 global Rec601_lightgreen = $BB655D # RGB = $90EE90 global Rec601_lightgrey = $C58080 # RGB = $D3D3D3 global Rec601_lightpink = $C07A9F # RGB = $FFB6C1 global Rec601_lightsalmon = $AE61AC # RGB = $FFA07A global Rec601_lightseagreen = $839240 # RGB = $20B2AA global Rec601_lightskyblue = $B39E5E # RGB = $87CEFA global Rec601_lightslategray = $828A77 # RGB = $778899 global Rec601_lightsteelblue = $B68E75 # RGB = $B0C4DE global Rec601_lightyellow = $E87282 # RGB = $FFFFE0 global Rec601_lime = $913622 # RGB = $00FF00 global Rec601_limegreen = $895347 # RGB = $32CD32 global Rec601_linen = $E07A85 # RGB = $FAF0E6 global Rec601_magenta = $6ACADE # RGB = $FF00FF global Rec601_maroon = $316DB8 # RGB = $800000 global Rec601_mediumaquamarine = $A28055 # RGB = $66CDAA global Rec601_mediumblue = $24DA71 # RGB = $0000CD global Rec601_mediumorchid = $7FA8A3 # RGB = $BA55D3 global Rec601_mediumpurple = $84AA88 # RGB = $9370DB global Rec601_mediumseagreen = $857550 # RGB = $3CB371 global Rec601_mediumslatenlue = $7BB87F # RGB = $7B68EE global Rec601_mediumspringgreen = $9D7B19 # RGB = $00FA9A global Rec601_mediumturquoise = $A09244 # RGB = $48D1CC global Rec601_mediumvioletred = $5B97C6 # RGB = $C71585 global Rec601_midnightblue = $2EA67A # RGB = $191970 global Rec601_mintcream = $E87F7C # RGB = $F5FFFA global Rec601_mistyrose = $DA7B8C # RGB = $FFE4E1 global Rec601_moccasin = $D6678F # RGB = $FFE4B5 global Rec601_navajowhite = $D26692 # RGB = $FFDEAD global Rec601_navy = $1DB877 # RGB = $000080 global Rec601_oldlace = $E37885 # RGB = $FDF5E6 global Rec601_olive = $714889 # RGB = $808000 global Rec601_olivedrab = $765678 # RGB = $6B8E23 global Rec601_orange = $A52AB3 # RGB = $FFA500 global Rec601_orangered = $7446D7 # RGB = $FF4500 global Rec601_orchid = $959DA7 # RGB = $DA70D6 global Rec601_palegoldenrod = $D36487 # RGB = $EEE8AA global Rec601_palegreen = $C4635C # RGB = $98FB98 global Rec601_paleturquoise = $CC8964 # RGB = $AFEEEE global Rec601_palevioletred = $8F80AC # RGB = $DB7093 global Rec601_papayawhip = $DF7289 # RGB = $FFEFD5 global Rec601_peachpuff = $D16C93 # RGB = $FFDAB9 global Rec601_peru = $8E57A5 # RGB = $CD853F global Rec601_pink = $C67C9B # RGB = $FFC0CB global Rec601_plum = $AF9296 # RGB = $DDA0DD global Rec601_powderblue = $C58A6A # RGB = $B0E0E6 global Rec601_purple = $3DA5AF # RGB = $800080 global Rec601_red = $515AF0 # RGB = $FF0000 global Rec601_rosybrown = $967994 # RGB = $BC8F8F global Rec601_royalblue = $6CBB66 # RGB = $4169E1 global Rec601_saddlebrown = $5860A2 # RGB = $8B4513 global Rec601_salmon = $9C68B7 # RGB = $FA8072 global Rec601_sandybrown = $AB56A8 # RGB = $F4A460 global Rec601_seagreen = $6A775B # RGB = $2E8B57 global Rec601_seashell = $E47B85 # RGB = $FFF5EE global Rec601_sienna = $6764A5 # RGB = $A0522D global Rec601_silver = $B58080 # RGB = $C0C0C0 global Rec601_skyblue = $B2975F # RGB = $87CEEB global Rec601_slateblue = $6DB07F # RGB = $6A5ACD global Rec601_slategray = $7B8978 # RGB = $708090 global Rec601_snow = $E87F82 # RGB = $FFFAFA global Rec601_springgreen = $9D6E19 # RGB = $00FF7F global Rec601_steelblue = $759F62 # RGB = $4682B4 global Rec601_tan = $AE6A90 # RGB = $D2B48C global Rec601_teal = $5D9348 # RGB = $008080 global Rec601_thistle = $BD8789 # RGB = $D8BFD8 global Rec601_tomato = $8A5DC7 # RGB = $FF6347 global Rec601_turquoise = $A6913B # RGB = $40E0D0 global Rec601_violet = $A69FA8 # RGB = $EE82EE global Rec601_wheat = $D06A8D # RGB = $F5DEB3 global Rec601_white = $EB8080 # RGB = $FFFFFF global Rec601_whitesmoke = $E28080 # RGB = $F5F5F5 global Rec601_yellow = $D21092 # RGB = $FFFF00 global Rec601_yellowgreen = $A44375 # RGB = $9ACD32 #Gray colors global Rec601_gray10 = $258080 # RGB = $191919 global Rec601_gray20 = $3B8080 # RGB = $323232 global Rec601_gray30 = $508080 # RGB = $4B4B4B global Rec601_gray40 = $678080 # RGB = $656565 global Rec601_gray50 = $7D8080 # RGB = $7F7F7F global Rec601_gray60 = $938080 # RGB = $989898 global Rec601_gray70 = $A88080 # RGB = $B1B1B1 global Rec601_gray80 = $BD8080 # RGB = $CACACA global Rec601_gray90 = $D48080 # RGB = $E4E4E4
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 25th February 2015 at 00:19. |
|
|
|
|
|
#6 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,392
|
Or rec709: colors_yuv_Rec709.avsi
Code:
# list of common colors (yuv values [Matrix='Rec709']) # source: # http://en.wikipedia.org/wiki/List_of_colors # http://en.wikipedia.org/wiki/X11_color_names # http://www.cryer.co.uk/resources/javascript/html2.htm global Rec709_aliceblue = $E4847C # RGB = $F0F8FF global Rec709_antiquewhite = $DB7687 # RGB = $FAEBD7 global Rec709_aqua = $BC9A10 # RGB = $00FFFF global Rec709_aquamarine = $D17A4A # RGB = $7FFFD4 global Rec709_azure = $E88279 # RGB = $F0FFFF global Rec709_beige = $E17581 # RGB = $F5F5DC global Rec709_bisque = $D76F8D # RGB = $FFE4C4 global Rec709_black = $108080 # RGB = $000000 global Rec709_blanchedalmond = $DC718A # RGB = $FFEBCD global Rec709_blue = $20F076 # RGB = $0000FF global Rec709_blueviolet = $52C7A2 # RGB = $8A2BE2 global Rec709_brown = $4B74B6 # RGB = $A52A2A global Rec709_burlywood = $B26793 # RGB = $DEB887 global Rec709_cadetblue = $8C8764 # RGB = $5F9EA0 global Rec709_chartreuse = $C41D52 # RGB = $7FFF00 global Rec709_chocolate = $7955B1 # RGB = $D2691E global Rec709_coral = $925EBA # RGB = $FF7F50 global Rec709_cornflowerblue = $8CAC67 # RGB = $6495ED global Rec709_cornsilk = $E57384 # RGB = $FFF8DC global Rec709_crimson = $487DD6 # RGB = $DC143C global Rec709_cyan = $BC9A10 # RGB = $00FFFF global Rec709_darkblue = $19BD7A # RGB = $00008B global Rec709_darkcyan = $6E8E43 # RGB = $008B8B global Rec709_darkgoldenrod = $85459B # RGB = $B8860B global Rec709_darkgray = $A18080 # RGB = $A9A9A9 global Rec709_darkgreen = $4D5E58 # RGB = $006400 global Rec709_darkkhaki = $AA5E86 # RGB = $BDB76B global Rec709_darkmagenta = $32AFB7 # RGB = $8B008B global Rec709_darkoliveGreen = $646879 # RGB = $556B2F global Rec709_darkorange = $9537B8 # RGB = $FF8C00 global Rec709_darkorchid = $57B9A7 # RGB = $9932CC global Rec709_darkred = $2972BD # RGB = $8B0000 global Rec709_darksalmon = $9E6BA6 # RGB = $E9967A global Rec709_darkseaGreen = $A6716E # RGB = $8FBC8F global Rec709_darkslateBlue = $4BA182 # RGB = $483D8B global Rec709_darkslateGray = $4E8372 # RGB = $2F4F4F global Rec709_darkturquoise = $9B9625 # RGB = $00CED1 global Rec709_darkviolet = $38CEB9 # RGB = $9400D3 global Rec709_deeppink = $54A0E2 # RGB = $FF1493 global Rec709_deepskyblue = $95AF2A # RGB = $00BFFF global Rec709_dimgray = $6A8080 # RGB = $696969 global Rec709_dodgerblue = $7EBC49 # RGB = $1E90FF global Rec709_firebrick = $4772BF # RGB = $B22222 global Rec709_floralwhite = $E77B83 # RGB = $FFFAF0 global Rec709_forestgreen = $6E5C56 # RGB = $228B22 global Rec709_fuchsia = $4ED6E6 # RGB = $FF00FF global Rec709_gainsboro = $CD8080 # RGB = $DCDCDC global Rec709_ghostwhite = $E58380 # RGB = $F8F8FF global Rec709_gold = $C31E9A # RGB = $FFD700 global Rec709_goldenrod = $9F409D # RGB = $DAA520 global Rec709_gray = $7E8080 # RGB = $808080 global Rec709_green = $5F554D # RGB = $008000 global Rec709_greenyellow = $CF2D64 # RGB = $ADFF2F global Rec709_honeydew = $E77B7A # RGB = $F0FFF0 global Rec709_hotpink = $8A92BF # RGB = $FF69B4 global Rec709_indianred = $7475B2 # RGB = $CD5C5C global Rec709_indigo = $26B29C # RGB = $4B0082 global Rec709_ivory = $EA7981 # RGB = $FFFFF0 global Rec709_khaki = $D25788 # RGB = $F0E68C global Rec709_lavender = $D7897F # RGB = $E6E6FA global Rec709_lavenderblush = $E18186 # RGB = $FFF0F5 global Rec709_lawngreen = $C11E52 # RGB = $7CFC00 global Rec709_lemonchiffon = $E56C84 # RGB = $FFFACD global Rec709_lightblue = $C38A6D # RGB = $ADD8E6 global Rec709_lightcoral = $9275B1 # RGB = $F08080 global Rec709_lightcyan = $E58372 # RGB = $E0FFFF global Rec709_lightgoldenrodyellow = $E46E82 # RGB = $FAFAD2 global Rec709_lightgreen = $C5605B # RGB = $90EE90 global Rec709_lightgrey = $C58080 # RGB = $D3D3D3 global Rec709_lightpink = $BA7DA0 # RGB = $FFB6C1 global Rec709_lightsalmon = $A866AB # RGB = $FFA07A global Rec709_lightseagreen = $8E8B40 # RGB = $20B2AA global Rec709_lightskyblue = $B79A5F # RGB = $87CEFA global Rec709_lightslategray = $838978 # RGB = $778899 global Rec709_lightsteelblue = $B68D76 # RGB = $B0C4DE global Rec709_lightyellow = $E97281 # RGB = $FFFFE0 global Rec709_lime = $AD2A1A # RGB = $00FF00 global Rec709_limegreen = $9A4C42 # RGB = $32CD32 global Rec709_linen = $DF7B85 # RGB = $FAF0E6 global Rec709_magenta = $4ED6E6 # RGB = $FF00FF global Rec709_maroon = $2773B8 # RGB = $800000 global Rec709_mediumaquamarine = $AB7B54 # RGB = $66CDAA global Rec709_mediumblue = $1DDA78 # RGB = $0000CD global Rec709_mediumorchid = $73ADA7 # RGB = $BA55D3 global Rec709_mediumpurple = $7DAB8B # RGB = $9370DB global Rec709_mediumseagreen = $906F4E # RGB = $3CB371 global Rec709_mediumslatenlue = $75B983 # RGB = $7B68EE global Rec709_mediumspringgreen = $B36F16 # RGB = $00FA9A global Rec709_mediumturquoise = $AA8C44 # RGB = $48D1CC global Rec709_mediumvioletred = $499FCA # RGB = $C71585 global Rec709_midnightblue = $2BA67C # RGB = $191970 global Rec709_mintcream = $E97F7C # RGB = $F5FFFA global Rec709_mistyrose = $D97C8C # RGB = $FFE4E1 global Rec709_moccasin = $D6698E # RGB = $FFE4B5 global Rec709_navajowhite = $D26790 # RGB = $FFDEAD global Rec709_navy = $18B87B # RGB = $000080 global Rec709_oldlace = $E37984 # RGB = $FDF5E6 global Rec709_olive = $764885 # RGB = $808000 global Rec709_olivedrab = $7D5575 # RGB = $6B8E23 global Rec709_orange = $A42EAE # RGB = $FFA500 global Rec709_orangered = $694FD4 # RGB = $FF4500 global Rec709_orchid = $8AA2AA # RGB = $DA70D6 global Rec709_palegoldenrod = $D46485 # RGB = $EEE8AA global Rec709_palegreen = $CF5E59 # RGB = $98FB98 global Rec709_paleturquoise = $D18664 # RGB = $AFEEEE global Rec709_palevioletred = $8685AE # RGB = $DB7093 global Rec709_papayawhip = $DF7388 # RGB = $FFEFD5 global Rec709_peachpuff = $D06E92 # RGB = $FFDAB9 global Rec709_peru = $8B5AA2 # RGB = $CD853F global Rec709_pink = $C17F9B # RGB = $FFC0CB global Rec709_plum = $A89598 # RGB = $DDA0DD global Rec709_powderblue = $C8876B # RGB = $B0E0E6 global Rec709_purple = $2FABB3 # RGB = $800080 global Rec709_red = $3F66F0 # RGB = $FF0000 global Rec709_rosybrown = $937B94 # RGB = $BC8F8F global Rec709_royalblue = $6AB96A # RGB = $4169E1 global Rec709_saddlebrown = $5563A1 # RGB = $8B4513 global Rec709_salmon = $936EB6 # RGB = $FA8072 global Rec709_sandybrown = $A75AA6 # RGB = $F4A460 global Rec709_seagreen = $737359 # RGB = $2E8B57 global Rec709_seashell = $E47C85 # RGB = $FFF5EE global Rec709_sienna = $6268A4 # RGB = $A0522D global Rec709_silver = $B58080 # RGB = $C0C0C0 global Rec709_skyblue = $B69460 # RGB = $87CEEB global Rec709_slateblue = $67B182 # RGB = $6A5ACD global Rec709_slategray = $7C8978 # RGB = $708090 global Rec709_snow = $E88082 # RGB = $FFFAFA global Rec709_springgreen = $B56115 # RGB = $00FF7F global Rec709_steelblue = $789C64 # RGB = $4682B4 global Rec709_tan = $AE6B8F # RGB = $D2B48C global Rec709_teal = $678D48 # RGB = $008080 global Rec709_thistle = $BA888A # RGB = $D8BFD8 global Rec709_tomato = $8064C6 # RGB = $FF6347 global Rec709_turquoise = $B2893A # RGB = $40E0D0 global Rec709_violet = $9AA5AB # RGB = $EE82EE global Rec709_wheat = $D06B8C # RGB = $F5DEB3 global Rec709_white = $EB8080 # RGB = $FFFFFF global Rec709_whitesmoke = $E28080 # RGB = $F5F5F5 global Rec709_yellow = $DB108A # RGB = $FFFF00 global Rec709_yellowgreen = $AD4170 # RGB = $9ACD32 #Gray colors global Rec709_gray10 = $258080 # RGB = $191919 global Rec709_gray20 = $3B8080 # RGB = $323232 global Rec709_gray30 = $508080 # RGB = $4B4B4B global Rec709_gray40 = $678080 # RGB = $656565 global Rec709_gray50 = $7D8080 # RGB = $7F7F7F global Rec709_gray60 = $938080 # RGB = $989898 global Rec709_gray70 = $A88080 # RGB = $B1B1B1 global Rec709_gray80 = $BD8080 # RGB = $CACACA global Rec709_gray90 = $D48080 # RGB = $E4E4E4
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 24th February 2015 at 23:58. |
|
|
|
|
|
#8 | Link | ||
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,392
|
Quote:
![]() Code:
#ColorPickerClip.avs
ColorsRGB = "colors_rgb.avsi"
DB = "Colors.DB"
MakeDB(DB,ColorsRGB)
MakeClip(DB).AssumeFPS(1.0)
Frames = (Height/48-10)+1
Loop(Frames,0,0)
Animate(0,Frames-1,"Spline36Resize",640,480,0,0,-0,480,640,480,0,Height-480,-0,480)
#ConvertToYV12() # To make the mp4
RT_FileDelete(DB) # EDIT: Added
Return last
Function RGB_2_YUV(Int RGB_Color,String Matrix) {
RGB_Color=RT_BitAnd(RGB_Color,$FFFFFF)
BlankClip(Width=16,Height=16,Length=1,Color=RGB_Color)
c=ConvertToYV12(matrix=matrix)
current_frame=0
Y=c.YPlaneMin() U=c.UPlaneMin() V=c.VPlaneMin()
Col = (((Y*256)+U)*256)+V
return Col
}
Function MakeDB(String DB,String ColorsRGB) {
myName="MakeDB: "
Assert(Exist(ColorsRGB),RT_String("%s %s Does not exist",myName,ColorsRGB))
Assert(DB!="",RT_String("%s DBase Name Cannot be null",myName))
Exist(DB) ? RT_FileDelete(DB) : NOP
GScript("""
RT_DBaseAlloc(DB,0,"iiis64")
TEXT=RT_ReadTxtFromFile(ColorsRGB)
LINES=RT_TxtQueryLines(TEXT)
for(i=0,LINES-1) {
S=RT_TxtGetLine(TEXT,i)
S=(S!="")?RT_StrReplaceDeep(RT_StrReplace(S,Chr(9)," ")," "," "):S
While(RT_Ord(S)==32) {S=MidStr(S,2)}
if(RT_Ord(S)!=RT_Ord("#") && RT_Ord(S)!=0) {
nm = RT_FindStr(S,"color_")
Assert(nm!=0,"Cannot find color name")
S = MidStr(S,nm)
nmend = RT_FindStr(S," ")
Assert(nm!=0,"Cannot find color name end")
Name = LeftStr(S,nmend)
S = MidStr(S,nmend)
Hx = RT_FindStr(S,"= $")
Assert(Hx!=0,"Cannot find Dollar")
RGB=RT_HexValue(S,pos=Hx+3)
YUV601=RGB_2_YUV(RGB,"Rec601")
YUV709=RGB_2_YUV(RGB,"Rec709")
RT_DBaseAppend(DB,RGB,YUV601,YUV709,Name)
}
}
""")
Return 0
}
Function MakeClip(String DB) {
H = 48
records = RT_DBaseRecords(DB)
nmtmpt = BlankClip(length=1,width=316,height=H,pixel_type="RGB32").KillAudio
hxtmpt = BlankClip(length=1,width=108,height=H,pixel_type="RGB32").KillAudio
NC = nmtmpt.BlankClip(color=$FFFFFF).Subtitle("Color Name",Align=5).LetterBox(2,2,2,2)
RGBC = hxtmpt.BlankClip(color=$FFFFFF).Subtitle("RGB",Align=5).LetterBox(2,2,2,2)
Y601C = hxtmpt.BlankClip(color=$FFFFFF).Subtitle("YUV rec601",Align=5).LetterBox(2,2,2,2)
Y709C = hxtmpt.BlankClip(color=$FFFFFF).Subtitle("YUV rec709",Align=5).LetterBox(2,2,2,2)
C = StackHorizontal(NC,RGBC,Y601C,Y709C)
GScript("""
for(i=0,records-1) {
RGB = RT_DBaseGetField(DB,i,0)
YUV601= RT_DBaseGetField(DB,i,1)
YUV709= RT_DBaseGetField(DB,i,2)
Name = RT_DBaseGetField(DB,i,3)
NC = nmtmpt.BlankClip(color=RGB).Subtitle(Name,Align=5).LetterBox(2,2,2,2)
RGBC = hxtmpt.BlankClip(color=$FFFFFF).Subtitle(RT_String("$%0.6X",RGB),Align=5).LetterBox(2,2,2,2)
Y601C = hxtmpt.BlankClip(color=$FFFFFF).Subtitle(RT_String("$%0.6X",YUV601),Align=5).LetterBox(2,2,2,2)
Y709C = hxtmpt.BlankClip(color=$FFFFFF).Subtitle(RT_String("$%0.6X",YUV709),Align=5).LetterBox(2,2,2,2)
TMPC = StackHorizontal(NC,RGBC,Y601C,Y709C)
C=StackVertical(C,TMPC)
}
""")
Return C
}
![]() And here Mp4 version (Rec601, 2MB): LINK REMOVED, See Post #21 Jumps upwards one color at each frame (each second). EDIT: VLC dont like the MP4, maybe because only 1.0 FPS (and/or 117kb/s). EDIT: Quote:
Only during conversion does rec601 or rec709 have any meaning. EDIT: Had to check, "Color_yuv only valid for YUV color spaces", error if using color_yuv with rgb result in BlankClip. EDIT: The diligent amongst you might notice two copies of "color_palegoldenrod" in the mp4, this is a duplicate in colors_rgb.avsi as installed by v2.6RC1, you might like to delete duplicate from your copy, reported in RC1 devs thread. EDIT: Changed posts #5 and #7, changed names from eg "global color_skyblue" to global Rec601_skyblue" and "global Rec709_skyblue" so can use the different colors avsi scripts together without conflict. EDIT: You can call avsi creation script using "PC601" and "PC709" as Matrix string instead of documented "PC.601" and "PC.709", the dot would break the global names (dot not valid in a variable name) in result avsi scripts. (valid for both post #4 and #5)
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 25th October 2018 at 14:51. |
||
|
|
|
|
|
#10 | Link |
|
/人 ◕ ‿‿ ◕ 人\
Join Date: May 2011
Location: Russia
Posts: 643
|
But you just don't need Hex.
Code:
BlankClip(pixel_type="YV12", color_yuv=RGB_2_YUV($191970, "Rec601")) Code:
BlankClip(pixel_type="YV12", color=$191970) |
|
|
|
|
|
#11 | Link |
|
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,676
|
Oops, I forgot about that. Thanks for the reminder. The reason I cannot use color=$191970 directly is because I'll get color differences depending on the matrix used. That's why I'm using RGB_2_YUV.
|
|
|
|
|
|
#12 | Link | |
|
/人 ◕ ‿‿ ◕ 人\
Join Date: May 2011
Location: Russia
Posts: 643
|
Quote:
Code:
BlankClip(color=$191970).ConvertToYV12(matrix) |
|
|
|
|
|
|
#14 | Link | |
|
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,676
|
Quote:
~355fps Code:
BlankClip(length=100000, width=1080, height=720, pixel_type="RGB24", color=$191970).ConvertToYV12(matrix="rec709") ![]() Code:
BlankClip(length=100000, width=1080, height=720, pixel_type="YV12", color_yuv=RGB_2_YUV($191970, "rec709")) |
|
|
|
|
|
|
#17 | Link |
|
Registered User
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
|
If you'd like to calculate the RGB <-> YUV conversions directly, these may be of some use.
Code:
#-------------------------------------------
# YUVToRGB 1.1.0
# Converts YUV format colour value to equivalent RGB format
#
# Useful when
#
# Working in YUV colourspace but filter requires values to be specified in RGB format
# Working in RGB colourspace but filter results or measurements are presented in YUV format
#
# YUVToRGB(int YUV, string "matrix", string "range")
#
# <YUV> YUV format colour value in either decimal or hexadecimal notation
# <matrix> Colour coefficient matrix to use in conversion - "Rec601" / "Rec709" / "FCC", default "Rec601"
# <range> YUV range: "limited" ([16,235]) or "full" ([0,255]), default "full"
#
# Requirements
#
# YUV value must fall within gamut of valid RGB values, otherwise unexpected or unusable output may result
#
# References
#
# http://avisynth.nl/index.php/Color_conversions
#
# Version history
#
# 1.1.0 Francois Visagie
# Added <range> parameter
# Replaced calculations with Avisynth "programming values" from above reference
# Updated References URL
#
# 1.0.0 Francois Visagie
#
function YUVToRGB(int YUV, string "matrix", string "range") {
range = Default(range, "full")
y = Int(YUV/65536.0)
u = Int((YUV - y*65536)/256.0)
v = YUV - y*65536 - u*256
Eval(ColourCoefficients(matrix))
range == "full" ? Eval("""
r = y + 2.0*(v-128.0)*(1-Kr)
g = y - 2.0*(u-128.0)*(1-Kb)*Kb/Kg - 2.0*(v-128.0)*(1-Kr)*Kr/Kg
b = y + 2.0*(u-128.0)*(1-Kb)
""") : \
range == "limited" ? Eval("""
r = (255.0/219.0)*y + (255.0/112.0)*v*(1-Kr) - (255.0*16.0/219.0 + 255.0*128.0/112.0*(1-Kr))
g = (255.0/219.0)*y - (255.0/112.0)*u*(1-Kb)*Kb/Kg - (255.0/112.0)*v*(1-Kr)*Kr/Kg \
- (255.0*16.0/219.0 - 255.0/112.0*128.0*(1-Kb)*Kb/Kg - 255.0/112.0*128.0*(1-Kr)*Kr/Kg)
b = (255.0/219.0)*y + (255.0/112.0)*u*(1-Kb) - (255.0*16.0/219.0 + 255.0*128.0/112.0*(1-Kb))
""") : \
Assert(false, """YUVToRGB: Invalid 'range' value """"+range+""""""")
r = Min(255, Max(Round(r), 0))
g = Min(255, Max(Round(g), 0))
b = Min(255, Max(Round(b), 0))
return(r*65536 + g*256 + b)
}
#-------------------------------------------
# RGBToYUV 1.1.0
# Converts RGB format colour value to equivalent YUV format
#
# Useful when
#
# Working in RGB colourspace but filter requires values to be specified in YUV format
# Working in YUV colourspace but filter results or measurements are presented in RGB format
#
# RGBToYUV(int RGB, string "matrix", string "range")
#
# <RGB> RGB format colour value in either decimal or hexadecimal notation
# <matrix> Colour coefficient matrix to use in conversion - "Rec601" / "Rec709" / "FCC", default "Rec601"
# <range> YUV range: "limited" ([16,235]) or "full" ([0,255]), default "full"
#
# References
#
# http://avisynth.nl/index.php/Color_conversions
#
# Version history
#
# 1.1.0 Francois Visagie
# Added <range> parameter
# Replaced calculations with Avisynth "programming values" from above reference
# Updated References URL
#
# 1.0.0 Francois Visagie
#
function RGBToYUV(int RGB, string "matrix", string "range") {
range = Default(range, "full")
r = Int(RGB/65536.0)
g = Int((RGB - r*65536)/256.0)
b = RGB - r*65536 - g*256
Eval(ColourCoefficients(matrix))
range == "full" ? Eval("""
y = Kr*r + Kg*g + Kb*b
v = 0.5*r - 0.5*g*Kg/(1-Kr) - 0.5*b*Kb/(1-Kr) + 128.0
u = - 0.5*r*Kr/(1-Kb) - 0.5*g*Kg/(1-Kb) + 0.5*b + 128.0
""") : \
range == "limited" ? Eval("""
y = (Kr*219.0/255.0)*r + (Kg*219.0/255.0)*g + (Kb*219.0/255.0)*b + 16.0
v = 112.0/255.0*r - Kg*112.0/255.0*g/(1-Kr) - Kb*112.0/255.0*b/(1-Kr) + 128.0
u = - Kr*112.0/255.0*r/(1-Kb) - Kg*112.0/255.0*g/(1-Kb) + 112.0/255.0*b + 128.0
""") : \
Assert(false, """RGBToYUV: Invalid 'range' value """"+range+""""""")
y = Min(255, Max(Round(y), 0))
u = Min(255, Max(Round(u), 0))
v = Min(255, Max(Round(v), 0))
return(y*65536 + u*256 + v)
}
#-------------------------------------------
# ColourCoefficients 1.0.0
# Generates specified colour matrix coefficient values
#
# Useful when
#
# Doing YUV<->RGB colourspace calculations or conversions
# Doing colour coefficient calculations or conversions
#
# ColourCoefficients(string "matrix")
#
# <matrix> Colour coefficient matrix which to generate coefficients for - "Rec601" / "Rec709" / "FCC", default "Rec601"
#
# Usage
#
# coeffs = ColourCoefficients("Rec709") # ColourCoefficients returns a multi-statement string with matrix coefficient value assignments
# Eval(coeffs) # This defines Kr containing Red channel coefficient, Kg with Green channel coefficient and Kb for Blue channel
# y = Round(Kr*r + Kg*g + Kb*b)
# ...
#
# References
#
# http://avisynth.org/mediawiki/Color1conversions
#
# Version history
#
# 1.0.0 Francois Visagie
#
function ColourCoefficients(string "matrix") {
matrix = Default(matrix, "Rec601")
matrixnum = (matrix == "Rec601") ? 0 : \
(matrix == "Rec709") ? 1 : \
(matrix == "FCC" ) ? 2 : 3
Assert(matrixnum < 3, """'matrix' value """" + matrix + """" is invalid""")
# Channel coefficients Rec.601 Rec.709 FCC
Kr = Select(matrixnum, 0.299, 0.2125, 0.3 )
Kg = Select(matrixnum, 0.587, 0.7154, 0.59)
Kb = Select(matrixnum, 0.114, 0.0721, 0.11)
return( \
"Kr=" + string(Kr) + "
Kg=" + string(Kg) + "
Kb=" + string(Kb))
}
|
|
|
|
|
|
#18 | Link | |
|
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,676
|
@ StainlessS
How can I add PC.709/601 to the script in post #8. I tried modifying the script but when I tried loading I get this error: Quote:
|
|
|
|
|
|
|
#19 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,392
|
Try this (not much testing, but think should be ok).
Have commented where made changes. You just needed to add two more 'i' fields to RT_DBaseAlloc() so s field moved to field 5. Code:
#ColorPickerClip.avs
ColorsRGB = "colors_rgb.avsi"
DB = "Colors.DB"
MakeDB(DB,ColorsRGB)
MakeClip(DB).AssumeFPS(1.0)
Frames = (Height/48-10)+1
Loop(Frames,0,0)
Animate(0,Frames-1,"Spline36Resize",640,480,0,0,-0,480,640,480,0,Height-480,-0,480)
#ConvertToYV12() # To make the mp4
RT_FileDelete(DB) # EDIT: Added
Return last
Function RGB_2_YUV(Int RGB_Color,String Matrix) {
RGB_Color=RT_BitAnd(RGB_Color,$FFFFFF)
BlankClip(Width=16,Height=16,Length=1,Color=RGB_Color)
c=ConvertToYV12(matrix=matrix)
current_frame=0
Y=c.YPlaneMin() U=c.UPlaneMin() V=c.VPlaneMin()
Col = ((Y*256+U)*256)+V
return Col
}
Function MakeDB(String DB,String ColorsRGB) {
myName="MakeDB: "
Assert(Exist(ColorsRGB),RT_String("%s %s Does not exist",myName,ColorsRGB))
Assert(DB!="",RT_String("%s DBase Name Cannot be null",myName))
Exist(DB) ? RT_FileDelete(DB) : NOP
GScript("""
RT_DBaseAlloc(DB,0,"iiiiis64") # Inserted two i fields BEFORE s field, so s field (Name) is now field 5
TEXT=RT_ReadTxtFromFile(ColorsRGB)
LINES=RT_TxtQueryLines(TEXT)
for(i=0,LINES-1) {
S=RT_TxtGetLine(TEXT,i)
S=(S!="")?RT_StrReplaceDeep(RT_StrReplace(S,Chr(9)," ")," "," "):S
While(RT_Ord(S)==32) {S=MidStr(S,2)}
if(RT_Ord(S)!=RT_Ord("#") && RT_Ord(S)!=0) {
nm = RT_FindStr(S,"color_")
Assert(nm!=0,"Cannot find color name")
S = MidStr(S,nm)
nmend = RT_FindStr(S," ")
Assert(nm!=0,"Cannot find color name end")
Name = LeftStr(S,nmend)
S = MidStr(S,nmend)
Hx = RT_FindStr(S,"= $")
Assert(Hx!=0,"Cannot find Dollar")
RGB=RT_HexValue(S,pos=Hx+3)
YUV601=RGB_2_YUV(RGB,"Rec601")
YUV709=RGB_2_YUV(RGB,"Rec709")
YUVPC601=RGB_2_YUV(RGB,"Pc601") # Added
YUVPC709=RGB_2_YUV(RGB,"Pc709") # Added
RT_DBaseAppend(DB,RGB,YUV601,YUV709,YUVPC601,YUVPC709,Name) # Inserted pc yuv before Name string field
}
}
""")
Return 0
}
Function MakeClip(String DB) {
H = 48
records = RT_DBaseRecords(DB)
nmtmpt = BlankClip(length=1,width=316,height=H,pixel_type="RGB32").KillAudio
hxtmpt = BlankClip(length=1,width=108,height=H,pixel_type="RGB32").KillAudio
NC = nmtmpt.BlankClip(color=$FFFFFF).Subtitle("Color Name",Align=5).LetterBox(2,2,2,2)
RGBC = hxtmpt.BlankClip(color=$FFFFFF).Subtitle("RGB",Align=5).LetterBox(2,2,2,2)
Y601C = hxtmpt.BlankClip(color=$FFFFFF).Subtitle("YUV rec601",Align=5).LetterBox(2,2,2,2)
Y709C = hxtmpt.BlankClip(color=$FFFFFF).Subtitle("YUV rec709",Align=5).LetterBox(2,2,2,2)
PCY601C = hxtmpt.BlankClip(color=$FFFFFF).Subtitle("YUV pc601",Align=5).LetterBox(2,2,2,2) # Added
PCY709C = hxtmpt.BlankClip(color=$FFFFFF).Subtitle("YUV pc709",Align=5).LetterBox(2,2,2,2) # Added
C = StackHorizontal(NC,RGBC,Y601C,Y709C,PCY601C,PCY709C) # Added PC clips
GScript("""
for(i=0,records-1) {
RGB = RT_DBaseGetField(DB,i,0)
YUV601 = RT_DBaseGetField(DB,i,1)
YUV709 = RT_DBaseGetField(DB,i,2)
PCYUV601= RT_DBaseGetField(DB,i,3) # Inserted field
PCYUV709= RT_DBaseGetField(DB,i,4) # Inserted field
Name = RT_DBaseGetField(DB,i,5) # Move from field 3 to field 5
NC = nmtmpt.BlankClip(color=RGB).Subtitle(Name,Align=5).LetterBox(2,2,2,2)
RGBC = hxtmpt.BlankClip(color=$FFFFFF).Subtitle(RT_String("$%0.6X",RGB),Align=5).LetterBox(2,2,2,2)
Y601C = hxtmpt.BlankClip(color=$FFFFFF).Subtitle(RT_String("$%0.6X",YUV601),Align=5).LetterBox(2,2,2,2)
Y709C = hxtmpt.BlankClip(color=$FFFFFF).Subtitle(RT_String("$%0.6X",YUV709),Align=5).LetterBox(2,2,2,2)
PCY601C= hxtmpt.BlankClip(color=$FFFFFF).Subtitle(RT_String("$%0.6X",PCYUV601),Align=5).LetterBox(2,2,2,2) # Added
PCY709C= hxtmpt.BlankClip(color=$FFFFFF).Subtitle(RT_String("$%0.6X",PCYUV709),Align=5).LetterBox(2,2,2,2) # Added
TMPC = StackHorizontal(NC,RGBC,Y601C,Y709C,PCY601C,PCY709C) # Added PC clips
C=StackVertical(C,TMPC)
}
""")
Return C
}
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
|
|
|
|
|
#20 | Link | |
|
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,676
|
Quote:
#Edit: some colors look similar due to the gif color limitations but overall looks nice ![]()
Last edited by Reel.Deel; 6th October 2015 at 00:00. Reason: add gif |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|