-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
268 lines (255 loc) · 20.6 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<Window x:Class="ChannelMixMatcher.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ChannelMixMatcher"
mc:Ignorable="d"
Title="ColorMixMatcher" MinHeight="900" Height="900" Width="1000" MinWidth="600">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="25"></RowDefinition>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="250"></ColumnDefinition>
<ColumnDefinition Width="200"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- Images -->
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="25"></RowDefinition>
<RowDefinition Height="5"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="25"></RowDefinition>
</Grid.RowDefinitions>
<Image Grid.Row="0" x:Name="ImageTop"></Image>
<DockPanel Grid.Row="1">
<Label>Test image</Label>
<Slider Minimum="0" Maximum="1" MinWidth="80" TickPlacement="BottomRight" TickFrequency="0.1" Value="1"></Slider>
<Label>Regrade</Label>
</DockPanel>
<GridSplitter Grid.Row="2" Height="3" VerticalAlignment="Center" HorizontalAlignment="Stretch" ShowsPreview="False">
</GridSplitter>
<Image Grid.Row="3" x:Name="ImageBottom"></Image>
<DockPanel Grid.Row="4">
<Label>Regrade</Label>
<Slider Minimum="0" Maximum="1" MinWidth="80" TickPlacement="BottomRight" TickFrequency="0.1" Value="1"></Slider>
<Label>Reference</Label>
</DockPanel>
</Grid>
<!-- Controls -->
<ScrollViewer Grid.Column="1">
<StackPanel>
<Button Click="SelectTest_Click">Select test image...</Button>
<DockPanel LastChildFill="True">
<Label >Assume gamma of test image:</Label>
<TextBox TextAlignment="Right" x:Name="TestImageGamma_txt">2.2</TextBox>
</DockPanel>
<Button Click="SelectReference_Click">Select reference image...</Button>
<DockPanel LastChildFill="True">
<Label>Assume gamma of reference image:</Label>
<TextBox TextAlignment="Right" x:Name="ReferenceImageGamma_txt">2.2</TextBox>
</DockPanel>
<DockPanel>
<DockPanel>
<Label DockPanel.Dock="Top" HorizontalAlignment="Center">Automatch</Label>
<TextBlock DockPanel.Dock="Bottom" TextAlignment="Center">1 0 0<LineBreak></LineBreak>
0 1 0<LineBreak></LineBreak>
0 0 1</TextBlock>
</DockPanel>
<StackPanel>
<Label HorizontalAlignment="Center">Manual</Label>
<Grid HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<TextBox Grid.Row="0" Grid.Column="0">1</TextBox>
<TextBox Grid.Row="0" Grid.Column="1">0</TextBox>
<TextBox Grid.Row="0" Grid.Column="2">0</TextBox>
<TextBox Grid.Row="1" Grid.Column="0">0</TextBox>
<TextBox Grid.Row="1" Grid.Column="1">1</TextBox>
<TextBox Grid.Row="1" Grid.Column="2">0</TextBox>
<TextBox Grid.Row="2" Grid.Column="0">0</TextBox>
<TextBox Grid.Row="2" Grid.Column="1">0</TextBox>
<TextBox Grid.Row="2" Grid.Column="2">1</TextBox>
</Grid>
</StackPanel>
<StackPanel>
<DockPanel>
<Label ToolTip="Should always be 1, except for reversing conversions that were mistakenly done in wrong gamma.">Work gamma:</Label>
<TextBox x:Name="WorkGamma_txt">1</TextBox>
</DockPanel>
<Button x:Name="btnLoadCHA" Click="BtnLoadCHA_Click" ToolTip="Load an RGB .CHA Channel Mixer Preset from Photoshop">Load PS CHA Preset*</Button>
<TextBlock TextWrapping="Wrap" TextAlignment="Center">
*This will overwrite manual matrix numbers
</TextBlock>
</StackPanel>
</DockPanel>
<DockPanel>
<Label>Set sliders:</Label>
<Button>Reset</Button>
<Button>Automatch</Button>
<Button>Manual</Button>
</DockPanel>
<StackPanel>
<DockPanel>
<Label>Slider range:</Label>
<TextBox Name="ChannelMixSliderFrom_txt">-2</TextBox>
<Label>To</Label>
<TextBox Name="ChannelMixSliderTo_txt">2</TextBox>
</DockPanel>
<DockPanel>
<Label>R>R</Label>
<TextBox DockPanel.Dock="Right" Text="{Binding ElementName=slide_RtoR, Path=Value, Mode=TwoWay}" Width="30" TextAlignment="Right"></TextBox>
<Slider Name="slide_RtoR" Value="1" Maximum="{Binding ElementName=ChannelMixSliderTo_txt,Path=Text}" Minimum="{Binding ElementName=ChannelMixSliderFrom_txt,Path=Text}" TickPlacement="BottomRight" Ticks="-5,-4,-3,-2,-1,0,1,2,3,4,5" SmallChange="0.01" LargeChange="0.1"></Slider>
</DockPanel>
<DockPanel>
<Label>G>R</Label>
<TextBox DockPanel.Dock="Right" Text="{Binding ElementName=slide_GtoR, Path=Value, Mode=TwoWay}" Width="30" TextAlignment="Right"></TextBox>
<Slider Name="slide_GtoR" Value="0" Maximum="{Binding ElementName=ChannelMixSliderTo_txt,Path=Text}" Minimum="{Binding ElementName=ChannelMixSliderFrom_txt,Path=Text}" TickPlacement="BottomRight" Ticks="-5,-4,-3,-2,-1,0,1,2,3,4,5" SmallChange="0.01" LargeChange="0.1"></Slider>
</DockPanel>
<DockPanel>
<Label>B>R</Label>
<TextBox DockPanel.Dock="Right" Text="{Binding ElementName=slide_BtoR, Path=Value, Mode=TwoWay}" Width="30" TextAlignment="Right"></TextBox>
<Slider Name="slide_BtoR" Value="0" Maximum="{Binding ElementName=ChannelMixSliderTo_txt,Path=Text}" Minimum="{Binding ElementName=ChannelMixSliderFrom_txt,Path=Text}" TickPlacement="BottomRight" Ticks="-5,-4,-3,-2,-1,0,1,2,3,4,5" SmallChange="0.01" LargeChange="0.1"></Slider>
</DockPanel>
<Border BorderThickness="1" BorderBrush="LightGray" Margin="5"></Border>
<DockPanel>
<Label>R>G</Label>
<TextBox DockPanel.Dock="Right" Text="{Binding ElementName=slide_RtoG, Path=Value, Mode=TwoWay}" Width="30" TextAlignment="Right"></TextBox>
<Slider Name="slide_RtoG" Value="0" Maximum="{Binding ElementName=ChannelMixSliderTo_txt,Path=Text}" Minimum="{Binding ElementName=ChannelMixSliderFrom_txt,Path=Text}" TickPlacement="BottomRight" Ticks="-5,-4,-3,-2,-1,0,1,2,3,4,5" SmallChange="0.01" LargeChange="0.1"></Slider>
</DockPanel>
<DockPanel>
<Label>G>G</Label>
<TextBox DockPanel.Dock="Right" Text="{Binding ElementName=slide_GtoG, Path=Value, Mode=TwoWay}" Width="30" TextAlignment="Right"></TextBox>
<Slider Name="slide_GtoG" Value="1" Maximum="{Binding ElementName=ChannelMixSliderTo_txt,Path=Text}" Minimum="{Binding ElementName=ChannelMixSliderFrom_txt,Path=Text}" TickPlacement="BottomRight" Ticks="-5,-4,-3,-2,-1,0,1,2,3,4,5" SmallChange="0.01" LargeChange="0.1"></Slider>
</DockPanel>
<DockPanel>
<Label>B>G</Label>
<TextBox DockPanel.Dock="Right" Text="{Binding ElementName=slide_BtoG, Path=Value, Mode=TwoWay}" Width="30" TextAlignment="Right"></TextBox>
<Slider Name="slide_BtoG" Value="0" Maximum="{Binding ElementName=ChannelMixSliderTo_txt,Path=Text}" Minimum="{Binding ElementName=ChannelMixSliderFrom_txt,Path=Text}" TickPlacement="BottomRight" Ticks="-5,-4,-3,-2,-1,0,1,2,3,4,5" SmallChange="0.01" LargeChange="0.1"></Slider>
</DockPanel>
<Border BorderThickness="1" BorderBrush="LightGray" Margin="5"></Border>
<DockPanel>
<Label>R>B</Label>
<TextBox DockPanel.Dock="Right" Text="{Binding ElementName=slide_RtoB, Path=Value, Mode=TwoWay}" Width="30" TextAlignment="Right"></TextBox>
<Slider Name="slide_RtoB" Value="0" Maximum="{Binding ElementName=ChannelMixSliderTo_txt,Path=Text}" Minimum="{Binding ElementName=ChannelMixSliderFrom_txt,Path=Text}" TickPlacement="BottomRight" Ticks="-5,-4,-3,-2,-1,0,1,2,3,4,5" SmallChange="0.01" LargeChange="0.1"></Slider>
</DockPanel>
<DockPanel>
<Label>G>B</Label>
<TextBox DockPanel.Dock="Right" Text="{Binding ElementName=slide_GtoB, Path=Value, Mode=TwoWay}" Width="30" TextAlignment="Right"></TextBox>
<Slider Name="slide_GtoB" Value="0" Maximum="{Binding ElementName=ChannelMixSliderTo_txt,Path=Text}" Minimum="{Binding ElementName=ChannelMixSliderFrom_txt,Path=Text}" TickPlacement="BottomRight" Ticks="-5,-4,-3,-2,-1,0,1,2,3,4,5" SmallChange="0.01" LargeChange="0.1"></Slider>
</DockPanel>
<DockPanel>
<Label>B>B</Label>
<TextBox DockPanel.Dock="Right" Text="{Binding ElementName=slide_BtoB, Path=Value, Mode=TwoWay}" Width="30" TextAlignment="Right"></TextBox>
<Slider Name="slide_BtoB" Value="1" Maximum="{Binding ElementName=ChannelMixSliderTo_txt,Path=Text}" Minimum="{Binding ElementName=ChannelMixSliderFrom_txt,Path=Text}" TickPlacement="BottomRight" Ticks="-5,-4,-3,-2,-1,0,1,2,3,4,5" SmallChange="0.01" LargeChange="0.1"></Slider>
</DockPanel>
<DockPanel>
<Label>Global multiplier:</Label>
<TextBox DockPanel.Dock="Right" Text="{Binding ElementName=slide_multiplier, Path=Value, Mode=TwoWay}" Width="30" TextAlignment="Right"></TextBox>
<Slider Name="slide_multiplier" Value="1" Maximum="5" Minimum="0" TickPlacement="BottomRight" TickFrequency="0.5" SmallChange="0.01" LargeChange="0.1"></Slider>
</DockPanel>
<Button IsEnabled="False">Auto-multiplier (avoid clipping)</Button>
<Button x:Name="btnMatrixInvert" Click="btnMatrixInvert_Click">Invert Matrix</Button>
<Button x:Name="btnSaveCHA" Click="BtnSaveCHA_Click">Export Channel Mixer Photoshop Preset</Button>
<DockPanel>
<Button>Export 3D LUT (.cube)</Button>
<Label>Gamma:</Label>
<TextBox TextAlignment="Right">1</TextBox>
</DockPanel>
<Border BorderThickness="1" BorderBrush="LightGray" Margin="5"></Border>
<DockPanel>
<Label>Match precision:</Label>
<TextBox TextAlignment="Right" x:Name="Precision_txt">0.1</TextBox>
<Label ToolTip="How many subdivisions per slider are used in one iteration of matching. Higher numbers drastically reduce speed. Basically, don't change.">Subdiv:</Label>
<TextBox TextAlignment="Right" x:Name="Subdiv_txt" TextChanged="updateIter_Change">4</TextBox>
</DockPanel>
<DockPanel>
<CheckBox IsChecked="True" ToolTip="Will ignore image spots where one of the channels is blown out, as the colormatching relies on the relative values of the channels to each other, so blown highlights compromise the result.">Ignore blown highlights</CheckBox>
<Label ToolTip="Lowest level at which a channel is considered to be blown out (0-255)">Threshold:</Label>
<TextBox>255</TextBox>
</DockPanel>
<DockPanel>
<CheckBox IsChecked="True" ToolTip="Will ignore image spots where one of the channels is crushed, as the colormatching relies on the relative values of the channels to each other, so crushed blacks compromise the result.">Ignore crushed blacks</CheckBox>
<Label ToolTip="Highest level at which a channel is considered to be crushed (0-255)">Threshold:</Label>
<TextBox>0</TextBox>
</DockPanel>
<!--Idea: Protect crushed highlight colors. Either by leaving all crushed pixels crushed/constant or by crushing other uncrushed channels according to the channelmixing to avoid color-->
<DockPanel>
<Label>Match range:</Label>
<TextBox x:Name="MatchFrom_txt">-2</TextBox>
<Label>To</Label>
<TextBox x:Name="MatchTo_txt">2</TextBox>
<CheckBox>Link to slider range</CheckBox>
</DockPanel>
<DockPanel>
<Label ToolTip="Higher resolutions drastically reduce speed. Basically don't change.">Match resolution:</Label>
<TextBox x:Name="MatchResX_txt" TextChanged="updateIter_Change">30</TextBox>
<Label>x</Label>
<TextBox x:Name="MatchResY_txt" TextChanged="updateIter_Change">30</TextBox>
</DockPanel>
<Button Background="Red" Foreground="White" FontWeight="Black" Click="DoColorMatch_Click">Run ColorMatch</Button>
</StackPanel>
</StackPanel>
</ScrollViewer>
<StackPanel Grid.Column="2">
<Label>Advanced settings</Label>
<Border BorderThickness="1" BorderBrush="LightGray" Margin="5"></Border>
<Label ToolTip="Method to use to downscale the source images to the matching resolution (full resolution would be impossibly slow)">Downscale method</Label>
<WrapPanel>
<RadioButton x:Name="useLabColorVarietyDownscale_radio" IsChecked="True" ToolTip="">Lab Color Variety</RadioButton>
<RadioButton x:Name="useNNDownscale_radio" ToolTip="Use when both images are pixel-perfectly aligned or are essentially the same image. Avoid for images sets with slight or strong distortions in relation to each other, as it will select pixels that do not match each other.">Nearest Neighbor</RadioButton>
<RadioButton x:Name="useDefaultDownscale_radio" ToolTip="Default downscale algorithm applied to original images. Ignores gamma and will result in some amount of color shift, however can help when the images have slight or severe geometric distortion towards each other and aren't pixel-perfectly aligned.">Default Downscaler</RadioButton>
<RadioButton x:Name="useLinearGammaDownscale_radio" ToolTip="" IsEnabled="False">Linear Gamma Downscale</RadioButton>
<RadioButton x:Name="useRGBHistogramDownscale_radio" ToolTip="" IsEnabled="False">RGB Histogram</RadioButton>
<!--<Label>Histogram Reference Radius</Label><TextBox IsEnabled="{Binding ElementName=useRGBHistogramDownscale_radio,Path=IsChecked}">1</TextBox>-->
</WrapPanel>
<Image x:Name="downscaledTestImage"></Image>
<Image x:Name="downscaledReferenceImage"></Image>
<Border BorderThickness="1" BorderBrush="LightGray" Margin="5"></Border>
<Label>Normalization Method</Label>
<WrapPanel>
<RadioButton x:Name="useRelativeNormalization_radio" IsChecked="True">relative</RadioButton>
<RadioButton x:Name="useAbsoluteNormalization_radio">absolute</RadioButton>
<RadioButton x:Name="useSuperRelativeNormalization_radio">super-relative</RadioButton>
</WrapPanel>
<Label>Difference/distance model</Label>
<WrapPanel IsEnabled="False">
<RadioButton x:Name="useSumDistance_radio" IsChecked="True">Sum of RGB differences</RadioButton>
<RadioButton x:Name="useSquaredSumDistance_radio" ToolTip="Use in combination with the 'Mean' aggregation model to effectively get MSE over all RGB values">Sum of squared RGB differences</RadioButton>
<RadioButton x:Name="useEuklidianDistance_radio">Euklidian</RadioButton>
<RadioButton x:Name="useCIE76Distance_radio">CIE76</RadioButton>
<RadioButton x:Name="useCMClcDistance_radio">CMC l:c</RadioButton>
<RadioButton x:Name="useCIE94Distance_radio">CIE94</RadioButton>
<RadioButton x:Name="useCIE2000Distance_radio">CIE2000</RadioButton>
</WrapPanel>
<Label>Difference aggregation method</Label>
<WrapPanel IsEnabled="False">
<RadioButton x:Name="useMeanDiffAggr_radio" IsChecked="True">Mean</RadioButton>
<RadioButton x:Name="useMSEDiffAggr_radio" ToolTip="Careful: If you use this together with 'Sum of squared RGB differences', you aren't getting an MSE over all channels of all pixels, but rather an MSE over the already summed square differences, e.g. if your linear RGB differences are [0 0 9] then you get 27 as a result and then this method will square it on top, resulting in 729. If you want a MSE over each individual channel of each pixel, use 'sum of squared RGB differences' with the normal 'Mean' method. Use this if you, for example, want the MSE of all CIE76 distances.">MSE</RadioButton>
<RadioButton x:Name="useMedianDiffAggr_radio">Median</RadioButton>
<RadioButton x:Name="usePeakDiffAggr_radio">Peak</RadioButton>
<RadioButton x:Name="usePSNRDiffAggr_radio">PSNR</RadioButton>
</WrapPanel>
</StackPanel>
</Grid>
<DockPanel Grid.Row="1">
<Label>Status: </Label>
<TextBlock x:Name="Status_txt">Idle.</TextBlock>
<TextBlock DockPanel.Dock="Right" x:Name="IterSteps_txt">N/A</TextBlock>
<Label HorizontalContentAlignment="Right">Amount of steps per iteration:</Label>
</DockPanel>
</Grid>
</Window>