CHDK Wiki
(Begin Generate Matrix section)
(Extend Generate Matrix section)
Line 19: Line 19:
 
== Generate Matrix ==
 
== Generate Matrix ==
 
=== Verifying Target Photo ===
 
=== Verifying Target Photo ===
If you have [http://www.sno.phy.queensu.ca/~phil/exiftool/ exiftool] installed, the following command will help verify that the target photo adheres to the steps above:
+
If you have [http://www.sno.phy.queensu.ca/~phil/exiftool/ exiftool] installed, the following command will help verify that the target photo adheres to the steps above. The command has been word wrapped for convenience, and should be concatenated into a single line:
  +
exiftool -p "Req 1) Progam/Manual mode: $Canon:EasyMode ($ShootingMode)"
:<code>exiftool -p "Req 1) Progam/Manual mode: $Canon:EasyMode ($ShootingMode)" -p "Req 2) Best jpeg quality: Quality=$Canon:Quality Size=$Canon:CanonImageSize" -p "Req 3) White balance to daylight: $Canon:WhiteBalance" -p "Req 4) Switch off all effects: Color Mode=$Canon:MyColorMode" -p "Req 5) Exposure compensation to -2/3: $ExposureCompensation" -p "Req 6) Focus to infinity: Range=$Canon:FocusRange, Focal Type=$Canon:FocalType, Focus Mode=$FocusMode (AF Mode=$Canon:AFMode)" -p "Req 7) Zoom to middle: $Canon:ShortFocal < $Canon:FocalLength (midpoint?) < $Canon:LongFocal (Digital Zoom=$Canon:DigitalZoom, Macro=$Canon:MacroMode)" -p "Req 8) Flash to off: $Flash" -p "Req 9) ISO to lowest value: $Canon:ISO (Base=$Canon:BaseISO)" -p "Reference Information: Model=$Model ($Canon:CanonModelID)" -p "Reference Information: Dimensions=$Canon:CanonImageWidth (Width) x $Canon:CanonImageHeight (Height)" <JPEGFilenameGoesHere></code>
 
  +
-p "Req 2) Best jpeg quality: Quality=$Canon:Quality Size=$Canon:CanonImageSize"
  +
-p "Req 3) White balance to daylight: $Canon:WhiteBalance"
  +
-p "Req 4) Switch off all effects: Color Mode=$Canon:MyColorMode"
  +
-p "Req 5) Exposure compensation to -2/3: $ExposureCompensation"
  +
-p "Req 6) Focus to infinity: Range=$Canon:FocusRange,
  +
Focal Type=$Canon:FocalType, Focus Mode=$FocusMode (AF Mode=$Canon:AFMode)"
  +
-p "Req 7) Zoom to middle: $Canon:ShortFocal < $Canon:FocalLength (midpoint?)
  +
< $Canon:LongFocal (Digital Zoom=$Canon:DigitalZoom, Macro=$Canon:MacroMode)"
  +
-p "Req 8) Flash to off: $Flash" -p "Req 9) ISO to lowest value: $Canon:ISO
  +
(Base=$Canon:BaseISO)"
  +
-p "Reference Information: Model=$Model ($Canon:CanonModelID)"
  +
-p "Reference Information: Dimensions=$Canon:CanonImageWidth (Width)
  +
x $Canon:CanonImageHeight (Height)" <JPEGFilenameGoesHere>
   
 
This will produce an output similar to the following for the nominated file (<JPEGFilenameGoesHere>):
 
This will produce an output similar to the following for the nominated file (<JPEGFilenameGoesHere>):
   
:<code>Req 1) Progam/Manual mode: Manual (Program AE)</code>
+
Req 1) Progam/Manual mode: Manual (Program AE)
:<code>Req 2) Best jpeg quality: Quality=Superfine Size=Large</code>
+
Req 2) Best jpeg quality: Quality=Superfine Size=Large
:<code>Req 3) White balance to daylight: Daylight</code>
+
Req 3) White balance to daylight: Daylight
:<code>Req 4) Switch off all effects: Color Mode=Off</code>
+
Req 4) Switch off all effects: Color Mode=Off
:<code>Req 5) Exposure compensation to -2/3: -2/3</code>
+
Req 5) Exposure compensation to -2/3: -2/3
:<code>Req 6) Focus to infinity: Range=Manual, Focal Type=Zoom, Focus Mode=Manual Focus (3) (AF Mode=Off (Manual Focus))</code>
+
Req 6) Focus to infinity: Range=Manual, Focal Type=Zoom, Focus Mode=Manual Focus (3)
  +
(AF Mode=Off (Manual Focus))
:<code>Req 7) Zoom to middle: 6 mm < 10.2 mm (midpoint?) < 72 mm (Digital Zoom=None, Macro=Normal)</code>
+
Req 7) Zoom to middle: 6 mm < 10.2 mm (midpoint?) < 72 mm (Digital Zoom=None, Macro=Normal)
:<code>Req 8) Flash to off: Off</code>
 
:<code>Req 9) ISO to lowest value: 81 (Base=79)</code>
+
Req 8) Flash to off: Off
  +
Req 9) ISO to lowest value: 81 (Base=79)
:<code>Reference Information: Model=Canon PowerShot S5 IS (PowerShot S5 IS)</code>
 
:<code>Reference Information: Dimensions=3264 (Width) x 2448 (Height)</code>
+
Reference Information: Model=Canon PowerShot S5 IS (PowerShot S5 IS)
  +
Reference Information: Dimensions=3264 (Width) x 2448 (Height)
 
Please note that in the example above requirement 7 (zoom to middle) has not been met because the zoom (10.2 mm) is not near the half way point between the minimum (6 mm) and maximum (72 mm) zoom values.
 
Please note that in the example above requirement 7 (zoom to middle) has not been met because the zoom (10.2 mm) is not near the half way point between the minimum (6 mm) and maximum (72 mm) zoom values.
 
=== Enabling Calibration ===
 
=== Enabling Calibration ===
Line 40: Line 54:
 
[[Image:Calib-01.png]]
 
[[Image:Calib-01.png]]
   
To enable it select the Settings button, select the Enable Calibration option, then select the OK button. The Calib button in the main program window should now be enabled.
+
To enable it select the {{button|Settings}} button, select the Enable Calibration option, then select the {{button|OK}} button.
  +
 
[[Image:Calib-02.png]]
 
[[Image:Calib-02.png]]
   
 
The {{button|Calibr}} button in the main program window should now be enabled.
=== Calculating Matrix ===
 
The Calibr button in the main program window opens the calibration windows.
 
[[Image:Calib-03.png|right|thumb|160px|Calibration Window]]
 
   
 
=== Calculating Matrix ===
# Use the button next to the RAW file text box to select the .CRW or .CR2 file containing your calibration target photo. Upon selecting the OK button the corresponding JPEG will automatically be selected.
 
  +
The {{button|Calibr}} button in the main program window opens the calibration windows.
# Gamma and Im. Bright sliders should be left at their defaluts. Using the brightness slider will be explained later.
 
 
[[Image:Calib-03.jpg|right|thumb|350px]]
# Resize the window (e.g. maximise it) to display the calibration photo.
 
# The calibration target contains 24 color patches. A minimum of 22 of the color patches need to be marked (areas), with the dark grey and black patches (last two patches on the bottom row) being optional. Typically all color patches except for the black patch (i.e. 23 patches) should be marked, and the order in which they are marked is not important. To mark the patches:
 
## Use your mouse to click, drag and then release within a color patch. This will draw a rectangle highlighting the selected area. The area will also appear in the areas list, and its co-ordinates will appear in the "spinners" so the dimensions of the selection can be fine tuned.
 
## Please make sure the contents of the selected area are all one color. In practice you should leave some solid color around the selection to ensure color bleed does not impact the quality of the matrix.
 
# '' To be added
 
   
   
  +
<ol>
 
<li>Use the {{button|...}} button next to the RAW file text box to select the .CRW or .CR2 file containing your calibration target photo. Upon selecting {{button|OK}} the corresponding JPEG will automatically be selected.</li>
 
<li>Gamma and Im. Bright sliders should be left at their defaults. Using the brightness slider will be explained later.</li>
 
<li>Resize the window (e.g. maximise it) to display the calibration photo.</li>
 
<li>The calibration target contains 24 color patches. A minimum of 22 of the color patches need to be marked (areas), with the dark grey and black patches (last two patches on the bottom row) being optional. Typically all color patches except for the black patch (i.e. 23 patches) should be marked, and the order in which they are marked is not important. To mark the patches:
  +
<ol>
 
<li>Use your mouse to click, drag and then release within a color patch. This will draw a rectangle highlighting the selected area. The area will also appear in the areas list, and its co-ordinates will appear in the "spinners" so the dimensions of the selection can be fine tuned.</li>
 
<li>Please make sure the contents of the selected area are all one color. This means you should leave some solid color around the selection to ensure color bleed does not impact the quality of the matrix.</li>
  +
</ol></li>
  +
<li>Once the color patches have been marked, select the {{button|Process}} button to begin calibration. The Progress and Results text box will reflect the following calibration stages:
  +
<ol>
  +
<li>Quick pass to locate a good gamma level for use when processing the image. If a minimum error level below 15% is found for any specific gamma, results are sufficient to proceed to the next stage. If the photo (or area selection) isn't sufficient to generate a good color matrix an error message will be displayed and processing will cease. If you see a message similar to below try the following to improve calibration before taking another photo of the target:
  +
<ul>
  +
<li>[[Image:Calib-04.png|thumb|right|100px]]Use the Im. Bright slider to reduce the brightness to 0.5</li>
  +
<li>Delete areas for the dark grey and black patches (two patches in the bottom right corner)</li>
  +
<li>Check the area positioning, and adjust the position or sizing of areas that stray too close to the edge of a color patch</li>
  +
<li>Check each area for visible issues with the target photo that may impact calibration. These could include smears, jagged lines, reflections on the screen, marks on the monitor's surface, etc. For jagged lines or smears on the screen consider increasing the refresh rate of your monitor and/or changing screen resolution.</li>
  +
</ul>
  +
Please make one change at a time and before using the {{button|Process}} button to restart calibration. Its also advisable to use the {{button|Clear}} button to clear the Progress and results area.
  +
</li>
  +
POOR RESULTS. CAN'T CONTINUE!!!
  +
REQUIRES MIN <= 15.0%.
  +
BEST RESULTS FROM G=1.47000, min(E)=56.1%
  +
<li>xxx</li>
  +
</ol>
  +
</li>
  +
</ol>
   
 
=== Verifying Matrix ===
 
=== Verifying Matrix ===

Revision as of 10:06, 29 May 2008

Please note: Most DNG4PS2 users will never need to use the calibration function. Calibration is only required when:

  • Adding support for a camera
  • Refining the color matrix for a currently supported camera

DNG4PS-2 converts CHDK RAW files into the more widely acceptable DNG format. To do this it needs to understand the color range produced by the camera to allow programs to interpret the picture correctly. Helping DNG4PS-2 understand a camera's color range (gammut) is a process referred to as calibration.

Calibration is a three step process:

  1. Photograph the calibration target
  2. Generate the color matrix
  3. Add the calibration data to DNG4PS-2

This article will describe how to use DNG4PS-2's inherent calibration functionality. More accurate techniques are available but require equipment not typically available to end users. Done properly these approximate color matricies can produce quite usable results.


Photograph Target

To be added

Generate Matrix

Verifying Target Photo

If you have exiftool installed, the following command will help verify that the target photo adheres to the steps above. The command has been word wrapped for convenience, and should be concatenated into a single line:

exiftool -p "Req 1) Progam/Manual mode: $Canon:EasyMode ($ShootingMode)"
-p "Req 2) Best jpeg quality: Quality=$Canon:Quality Size=$Canon:CanonImageSize"
-p "Req 3) White balance to daylight: $Canon:WhiteBalance"
-p "Req 4) Switch off all effects: Color Mode=$Canon:MyColorMode"
-p "Req 5) Exposure compensation to -2/3: $ExposureCompensation"
-p "Req 6) Focus to infinity: Range=$Canon:FocusRange,
 Focal Type=$Canon:FocalType, Focus Mode=$FocusMode (AF Mode=$Canon:AFMode)"
-p "Req 7) Zoom to middle: $Canon:ShortFocal < $Canon:FocalLength (midpoint?)
 < $Canon:LongFocal (Digital Zoom=$Canon:DigitalZoom, Macro=$Canon:MacroMode)"
-p "Req 8) Flash to off: $Flash" -p "Req 9) ISO to lowest value: $Canon:ISO
 (Base=$Canon:BaseISO)"
-p "Reference Information: Model=$Model ($Canon:CanonModelID)"
-p "Reference Information: Dimensions=$Canon:CanonImageWidth (Width)
 x $Canon:CanonImageHeight (Height)" <JPEGFilenameGoesHere>

This will produce an output similar to the following for the nominated file (<JPEGFilenameGoesHere>):

Req 1) Progam/Manual mode: Manual (Program AE)
Req 2) Best jpeg quality: Quality=Superfine Size=Large
Req 3) White balance to daylight: Daylight
Req 4) Switch off all effects: Color Mode=Off
Req 5) Exposure compensation to -2/3: -2/3
Req 6) Focus to infinity: Range=Manual, Focal Type=Zoom, Focus Mode=Manual Focus  (3)
 (AF Mode=Off (Manual Focus))
Req 7) Zoom to middle: 6 mm < 10.2 mm (midpoint?) < 72 mm (Digital Zoom=None, Macro=Normal)
Req 8) Flash to off: Off
Req 9) ISO to lowest value: 81 (Base=79)
Reference Information: Model=Canon PowerShot S5 IS (PowerShot S5 IS)
Reference Information: Dimensions=3264 (Width) x 2448 (Height)

Please note that in the example above requirement 7 (zoom to middle) has not been met because the zoom (10.2 mm) is not near the half way point between the minimum (6 mm) and maximum (72 mm) zoom values.

Enabling Calibration

To enable calibration you must first have installed DNG4PS-2 version 0.2.2 beta 25 or later. By default the calibration function will be disabled. Calib-01

To enable it select the Settings button, select the Enable Calibration option, then select the OK button.

Calib-02

The Calibr button in the main program window should now be enabled.

Calculating Matrix

The Calibr button in the main program window opens the calibration windows.

Calib-03


  1. Use the ... button next to the RAW file text box to select the .CRW or .CR2 file containing your calibration target photo. Upon selecting OK the corresponding JPEG will automatically be selected.
  2. Gamma and Im. Bright sliders should be left at their defaults. Using the brightness slider will be explained later.
  3. Resize the window (e.g. maximise it) to display the calibration photo.
  4. The calibration target contains 24 color patches. A minimum of 22 of the color patches need to be marked (areas), with the dark grey and black patches (last two patches on the bottom row) being optional. Typically all color patches except for the black patch (i.e. 23 patches) should be marked, and the order in which they are marked is not important. To mark the patches:
    1. Use your mouse to click, drag and then release within a color patch. This will draw a rectangle highlighting the selected area. The area will also appear in the areas list, and its co-ordinates will appear in the "spinners" so the dimensions of the selection can be fine tuned.
    2. Please make sure the contents of the selected area are all one color. This means you should leave some solid color around the selection to ensure color bleed does not impact the quality of the matrix.
  5. Once the color patches have been marked, select the Process button to begin calibration. The Progress and Results text box will reflect the following calibration stages:
    1. Quick pass to locate a good gamma level for use when processing the image. If a minimum error level below 15% is found for any specific gamma, results are sufficient to proceed to the next stage. If the photo (or area selection) isn't sufficient to generate a good color matrix an error message will be displayed and processing will cease. If you see a message similar to below try the following to improve calibration before taking another photo of the target:
      • Calib-04
        Use the Im. Bright slider to reduce the brightness to 0.5
      • Delete areas for the dark grey and black patches (two patches in the bottom right corner)
      • Check the area positioning, and adjust the position or sizing of areas that stray too close to the edge of a color patch
      • Check each area for visible issues with the target photo that may impact calibration. These could include smears, jagged lines, reflections on the screen, marks on the monitor's surface, etc. For jagged lines or smears on the screen consider increasing the refresh rate of your monitor and/or changing screen resolution.

      Please make one change at a time and before using the Process button to restart calibration. Its also advisable to use the Clear button to clear the Progress and results area.

    2. POOR RESULTS. CAN'T CONTINUE!!! REQUIRES MIN <= 15.0%. BEST RESULTS FROM G=1.47000, min(E)=56.1%
    3. xxx

Verifying Matrix

To be added

Calibrate DNG4PS-2

Currently DNG4PS-2 calibration requires modifications to the source code. To request developers to apply your color matrix please post to the following thread. Please include:

  • Links to the calibration photos used
  • Links to test photos used to confirm the results
  • A text file including the processing log generated by DNG4PS-2