<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Scan Recognition Format File (.cht)</title> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <meta name="author" content="Graeme Gill"> </head> <body> <h2>Description of the .cht format</h2> [This is a rather inflexible format, that should really be replaced with a CGATS style file.]<br> <br> The <span style="font-weight: bold;">.cht</span> format file is used to hold the image recognition information that allows the <a href="scanin.html">scanin</a> program to align the input image with the specified sample boxes.<br> <br> A raw <span style="font-weight: bold;">.cht</span> file can be produced by running <a href="scanin.html">scanin</a> with the <a href="scanin.html#g">-g</a> option, although this will then need cleaning up manually, using a text editor. The cleanup consists of deleting any unwanted reference lines from the XLIST and YLISTs, adding the the sample box references, and possibly adding the expected sample values.<br> <br> The <span style="font-weight: bold;">.cht</span> image recognition file is usually set up to recognized a scanned test chart that includes the edges of the chart itself, <span style="font-weight: bold;">not</span> a cropped version of the chart that excludes the edges of the chart itself. This is to allow <span style="font-weight: bold;">scanin</span> to be used with scans that have just be roughly cropped, without requiring that a scan be treated in detail with an application such as Adobe Photoshop.<br> <br> The keywords and associated data must be used in the following order: <b>BOXES</b>, <b>BOX_SHRINK</b>, <b>REF_ROTATION</b>, <b>XLIST</b>, <b>YLIST</b> and <b>EXPECTED</b>.<br> <br> The physical units used for boxes and edge lists are arbitrary units (i.e. pixels as generated by scanin -g, but could be mm, inches etc. if created some other way), the only requirement is that the sample box definitions need to agree with the X/YLIST definitions. Typically if a scanned chart is used to build the reference, the units will be pixels of the scanned chart.<br> <br> The <b>BOXES</b> keyword introduces the list of diagnostic and sample boxes. The integer following this keyword must be the total number of diagnostic and sample boxes, but <span style="font-weight: bold;">not</span> including any fiducual marks. The lines following the BOXES keyword must then contain the fiducial mark, diagnostic or sample box definitions. Each box definition line consists of 11 space separated parameters, and can generate a grid of sample or diagnostic boxes:<br> <br> <b>kl lxs lxe lys lye w h xo yo xi yi</b><br> <br> with the following usage:<br> <br> <b>kl</b> is a key letter.<br> <br> <span style="font-weight: bold;">F</span> is used to define four fiducial mZarks that may be used for manual alignment of an image to the target. The four marks are nominally a top left mark, a top right mark, bottom right mark and a bottom left mark. The parameters are labeled as follows:<br> <b><br> </b><b>F _ _ x0 y0 x1 y1 x2 y2 x3 y3<br> <br> </b>Where the first two parameters are not used, and a '_' character should be used as a place holder, and the follows the X and Y coordinates for the four fiducial marks.<span style="font-weight: bold;"></span><span style="font-weight: bold;"></span> Typically fiducial marks are chosen to be at the corners of the overall bounding box, or at corner cross marks on the chart etc. Fiducial marks may be omitted, but in this case manual alignment cannot be used.<br> <br> <b>D</b> is used for a diagnostic box which will show up in the diagnostic raster output, but is not used as a sample box. The label information can be arbitrary.<br> <br> <b>X</b> is used for a sequence of boxes in which the X label comes first in the concatenated sample box label.<br> <br> <b>Y</b> is used for a sequence of boxes in which the Y label comes first in the concatenated sample box label.<br> <br> Boxes are created incrementing in the X direction fastest, and the Y direction slowest.<br> <br> <b>lxs</b> is the X axis starting label. This is generally a letter or number, and it will be incremented appropriately to reach <b>lxe</b><br> <br> <b>lxe</b> is the X axis ending label. When the X label reaches this this value (inclusively), the iteration in the X direction will reset.<br> <br> <b>lys</b> is the Y axis starting label. This is generally a letter or number, and it will be incremented appropriately to reach <b>lye</b><br> <br> <b>lye</b> is the Y axis ending label. When the Y label reaches this this value (inclusively), the iteration through the boxes will end.<br> <br> The X & Y labels will be concatenated to form the sample box label.<br> <br> A sample label that consists of the character '_' is treated as a null label (useful for an array that only iterates in one direction).<br> <br> <b>w</b>,<b> h</b> are the width and height of each box in the array.<br> <br> <b>xo</b>, <b>yo</b> are the origin of the top left of the array.<br> <br> <b>xi</b>, <b>yi</b> are the increments between each box in the array.<br> <br> A blank line should follow the last box definition line.<br> <br> The keyword <b>BOX_SHRINK</b> marks the definition of how much each sample box should be shrunk on each edge before sampling the pixel values. This allows the sample boxes to be defined at their edges, while allowing a safety margin for the pixels actually sampled. The units are the same arbitrary units used for the sample box definitions.<br> <br> A blank line should follow this keyword.<br> <br> The optional <b>REF_ROTATION</b> keyword indicates the rotation in radians clockwise of the reference image when the edge lists were generated. This amount of rotation is undone to the image before applying the sample box location information. The rotation is about the origin (the origin is assumed to be upper left corner). If omitted, the reference rotation is assumed to be 0.0<br> <br> A blank line should follow this keyword.<br> <br> The <b>XLIST</b> is a list of vertical edge reference "ticks", along the X axis. Ticks are just edge transitions, typically being each edge of the sample boxes, but should include edges of any features that have significant width and a length that is at least 50% of the available space. It is these edge ticks that are used to locate the reference cells position within the input raster. The integer after the keyword "XLIST" is the number of entries in the list. The first number in the column is the offset of the tick from the origin, the second number is used to improve the correlation by representing the strength of that "tick" relative to the strongest tick which will have a value 1.0. Strength is measured by the relative length of the edge.<br> <br> The third number represents the relative number of times this "tick" is crossed by lines in the other direction. A line is regarded as crossing if part of it is closer to the "tick" line that half the distance to the next tick line. The number is normalized so that the largest crossing count has a weight of 1.0. This may be set to 1.0 if it is not known or easily computed.<br> <br> A blank line should follow the last <b>XLIST</b> edge definition.<br> <br> The <b>YLIST</b> is same format and details as the <b>XLIST</b>, used for horizontal edges.<br> <br> The <b>EXPECTED</b> keyword introduces an optional list of <span style="text-decoration: underline;">approximate</span> expected sample box color values, allowing better identification of the possible rotation of a chart, particularly if it has no asymmetric patch shapes or locations in the chart. Following the keyword should either be <b>XYZ</b> or <b>LAB</b>, depending on the color space used to describe the reference values, then an integer indicating the number of entries in the list.<br> <br> Each following expected color entry consists of four values. The first is the sample box label, which should correspond to one of those defined by the <b>BOXES</b> entry above. It is an error if no corresponding box has been defined. The remaining three values are the <span style="text-decoration: underline;">approximate</span> XYZ or L*a*b* color value expected for that sample box. The XYZ values are assumed to be scaled to a maximum Y value of 100. An expected color value doesn't have to be provided for every defined sample box, nor is it expected to be accurate - it just has to represent the approximate expected color. (Actual chart reference values are provided as a separate CGATS file to <a href="scanin.html"><span style="font-weight: bold;">scanin</span></a>).<br> <br> A blank line should follow the last <b>EXPECTED</b> box value.<br> <br> <br> <hr size="2" width="100%"><br> The following is an example .cht file, suitable for a typical Q60 IT8 scan target.<br> <tt><br> <font size="-1"> BOXES 290<br> F _ _ _ _ 1 1 615.5 1.5 615 409<br> D ALL ALL _ _ 615 409 1 1 0 0<br> D MARK MARK _ _ 14 14 1 1 0 0<br> Y 01 22 A L 25.625 25.625 26.625 26.625 25.625 25.625<br> X GS00 GS23 _ _ 25.625 51.25 0.0 358.75 25.625 0.0<br> <br> BOX_SHRINK 3.0<br> <br> REF_ROTATION -0.002006<br> <br> XLIST 32<br> 1.799625 1.000000 0.312500<br> 27.064987 0.874039 0.750000<br> 52.592403 0.133439 0.687500<br> 78.196610 0.264191 0.687500<br> 104.117756 0.165427 0.937500<br> 129.377994 0.844432 0.937500<br> 155.144274 0.501218 0.875000<br> 180.839181 0.491428 0.937500<br> 206.359758 0.212384 0.937500<br> 232.038808 0.851851 0.937500<br> 257.854725 0.162956 0.625000<br> 283.552463 0.101243 0.812500<br> 300.534000 0.024750 0.812500<br> 309.507688 0.093829 1.000000<br> 334.711314 0.856821 1.000000<br> 360.428194 0.787677 1.000000<br> 385.849730 0.748130 0.937500<br> 386.650071 0.039487 0.687500<br> 394.630372 0.024725 0.687500<br> 411.835654 0.802501 0.750000<br> 414.017731 0.041974 0.937500<br> 437.133504 0.674062 0.937500<br> 437.975355 0.103714 1.000000<br> 462.938460 0.671643 1.000000<br> 463.880560 0.093836 0.937500<br> 488.517995 0.679022 1.000000<br> 514.338544 0.760511 1.000000<br> 540.037492 0.111108 0.625000<br> 565.856396 0.133330 0.562500<br> 591.114717 0.565475 0.562500<br> 603.447516 0.032097 0.312500<br> 615.984915 0.829608 0.250000<br> <br> YLIST 22<br> 2.477956 0.993407 0.142857<br> 12.988903 0.016393 0.190476<br> 14.739109 0.036082 0.190476<br> 26.746171 0.911487 0.428571<br> 52.537114 0.303282 0.904762<br> 78.060317 0.585303 0.857143<br> 103.498271 0.606862 0.761905<br> 128.994535 0.567266 0.761905<br> 154.483041 0.550814 0.714286<br> 179.935985 0.623055 0.666667<br> 205.552940 0.350826 0.714286<br> 212.051372 0.016393 0.714286<br> 231.153547 0.824618 0.857143<br> 256.697418 0.744268 0.952381<br> 282.145841 0.736126 0.904762<br> 307.899015 0.536075 0.952381<br> 333.262903 0.903282 0.809524<br> 340.217754 0.019722 0.190476<br> 344.988867 0.019671 0.095238<br> 346.988885 0.018032 0.095238<br> 358.840278 0.999967 1.000000<br> 409.201393 1.000000 0.000000<br> <br> EXPECTED XYZ 264<br> A1 3.85 3.22 1.9<br> A2 4.89 3.27 1.6<br> A3 5.87 3.31 1.33<br> A4 6.3 3.38 1.19<br> A5 13.01 11.44 7.64<br> A6 16.14 11.99 6.81<br> A7 19.35 12.41 6.06<br> A8 20.41 11.97 5.3<br> A9 43.5 42.81 32.65<br> A10 45.58 42.37 30.95<br> A11 48.99 43.2 29.9<br> A12 50.73 44.02 29.96<br> A13 74.46 78.76 66.06<br> A14 75.66 76.42 64.08<br> A15 78.36 81.34 65.41<br> A16 70.52 73.3 59.16<br> A17 74.98 75.98 60.69<br> A18 72.85 77.3 60.25<br> A19 73.09 75.52 64.54<br> B1 3.47 3.08 1.41<br> B2 4.41 3.25 0.9<br> B3 5.04 3.23 0.58<br> B4 5.19 3.11 0.47<br> B5 13.36 11.59 5.56<br> B6 15.97 12.03 3.69<br> B7 19.2 12.49 2.2<br> B8 19.73 11.52 1.17<br> B9 42.19 41.84 29.34<br> B10 44.83 42.17 25.93<br> B11 48.06 42.9 23.01<br> B12 49.63 43.08 21.34<br> B13 66.21 72.54 64.61<br> B14 70.16 67.1 60.33<br> B15 75.46 78.69 51.58<br> B16 57.47 59.58 47.66<br> B17 68.33 66.45 49.05<br> B18 63.89 70.29 51.3<br> B19 61.12 62.16 59.79<br> C1 4.97 4.75 1.98<br> C2 5.18 4.65 1.23<br> C3 5.51 4.58 0.71<br> C4 5.77 4.61 0.67<br> C5 24.57 23.44 10.14<br> C6 28.1 24.64 5.22<br> C7 31.15 25.28 2.2<br> C8 30.85 23.68 1.35<br> C9 49.16 49.36 32.37<br> C10 51.72 50.72 26.53<br> C11 55.24 53.14 21.93<br> C12 56.87 53.62 18.46<br> C13 57.68 65.65 62.7<br> C14 63.46 56.66 55.49<br> C15 73 76.11 40.78<br> C16 44.73 46.38 36.8<br> C17 60.64 55.73 38.1<br> C18 52.15 60.27 41.5<br> C19 48.13 49.18 54.38<br> D1 4.19 4.41 1.93<br> D2 4.48 4.72 1.24<br> D3 4.55 4.78 0.8<br> D4 4.32 4.53 0.78<br> D5 27.33 28.55 12.95<br> D6 28.68 30.04 7.25<br> D7 29.51 31.01 3.41<br> D8 27.55 28.44 1.83<br> D9 56.06 58.19 38.21<br> D10 56.03 58.46 30.02<br> D11 56.2 59.33 24.44<br> D12 56.19 59.41 19.14<br> D13 48.21 57.42 59.53<br> D14 58.18 49.14 51.36<br> D15 70.98 73.73 33.63<br> D16 34.31 35.73 28.22<br> D17 54.27 47.53 29.58<br> D18 41.67 50.64 32.28<br> D19 36.95 37.82 48.09<br> E1 4.15 4.75 2.03<br> E2 4 4.98 1.37<br> E3 3.3 4.49 0.86<br> E4 3.11 4.3 0.86<br> E5 13.11 14.9 7.06<br> E6 12.26 15.23 4.18<br> E7 11.53 15.57 2.27<br> E8 9.69 13.74 1.51<br> E9 39.15 42.08 27.33<br> E10 37.43 41.51 22.23<br> E11 36.99 42.5 18.85<br> E12 36.4 42.58 16.27<br> E13 39.97 49.81 56.15<br> E14 52.08 41.07 46.36<br> E15 68.71 70.76 26.45<br> E16 25.7 26.97 21.28<br> E17 48.53 40.6 22<br> E18 31.62 40.82 23.35<br> E19 31.19 31.19 43.4<br> F1 1.51 1.91 1.06<br> F2 1.29 2.04 0.98<br> F3 1.16 2.09 0.82<br> F4 1.14 2.04 0.8<br> F5 6.53 8.25 5.13<br> F6 5.61 8.66 4.38<br> F7 4.6 8.77 3.7<br> F8 3.45 7.63 2.78<br> F9 37.8 41.07 30.91<br> F10 35.92 40.76 29.03<br> F11 35.42 41.99 29.07<br> F12 34 41.8 28<br> F13 32.13 42.12 51.99<br> F14 45.72 33.34 40.77<br> F15 66.26 67.29 19.65<br> F16 17.02 18.07 14.4<br> F17 41.59 32.53 15.16<br> F18 26.26 35.26 18.81<br> F19 24.3 23.6 37.48<br> G1 2.31 3 2.27<br> G2 2 3.21 2.58<br> G3 1.66 3.21 2.75<br> G4 1.58 3.03 2.6<br> G5 8.99 11.08 8.79<br> G6 7.68 11.3 9.56<br> G7 6.52 11.5 10.2<br> G8 5.5 10.85 10.55<br> G9 38.29 41.75 33.45<br> G10 35.83 41.16 34.11<br> G11 34.56 41.83 35.63<br> G12 33.69 42.14 36.7<br> G13 25.95 35.68 48<br> G14 40.6 27.62 36.14<br> G15 63.72 63.63 14.35<br> G16 10.85 11.82 9.58<br> G17 37.23 27.64 11.62<br> G18 20.28 28.97 14.15<br> G19 17.7 16.74 31.7<br> H1 2.56 3.04 2.92<br> H2 2.34 3.2 4.12<br> H3 2.12 3.28 5.43<br> H4 2.06 3.18 5.29<br> H5 10.07 11.6 11.24<br> H6 9.01 11.68 14.81<br> H7 8.22 12 19.42<br> H8 7.25 11.55 21.45<br> H9 39.25 42.31 36.81<br> H10 37.58 41.85 40.37<br> H11 37.16 43.07 45.79<br> H12 36.27 43.78 49.47<br> H13 21.47 30.78 44.22<br> H14 36.49 23.35 32.38<br> H15 61.58 60.55 10.95<br> H16 8.21 8.71 6.91<br> H17 33.04 23.26 8.38<br> H18 16.22 24.35 10.41<br> H19 12.86 11.84 26.82<br> I1 4.22 4.44 5.28<br> I2 4.35 4.48 8.36<br> I3 4.4 4.44 11.94<br> I4 4.48 4.58 12.17<br> I5 15.15 15.78 15.23<br> I6 14.56 15.12 19.52<br> I7 14.37 14.81 24.48<br> I8 14.11 14.76 30.03<br> I9 41.03 42.58 36.94<br> I10 40.85 42.23 40.73<br> I11 40.86 42.33 45.05<br> I12 41.31 42.73 47.77<br> I13 17.26 25.93 40.23<br> I14 32.66 19.63 28.81<br> I15 59.37 57.18 7.79<br> I16 4.97 5.32 4.32<br> I17 28.62 18.88 5.48<br> I18 11.58 18.98 7.25<br> I19 9.58 8.34 22.87<br> I20 0.45 0.4 0.33<br> I21 2.28 1.78 0.98<br> I22 2.37 1.95 0.85<br> J1 2.15 1.9 2.6<br> J2 2.57 2 4.72<br> J3 2.93 1.95 8.1<br> J4 3.15 1.92 10.76<br> J5 11.73 11.6 11.81<br> J6 12.98 11.93 16.19<br> J7 13.91 12.07 20.95<br> J8 14.01 11.59 24.35<br> J9 40.75 41.22 36.34<br> J10 41.26 41.07 39.74<br> J11 42.63 41.68 44.51<br> J12 44.02 41.78 49.25<br> J13 13.82 21.69 35.98<br> J14 28.87 16.33 25.08<br> J15 56.04 52.29 4.97<br> J16 2.46 2.63 2.29<br> J17 24.04 14.75 3.15<br> J18 8.12 14.49 4.55<br> J19 5.98 4.79 17.76<br> J20 8.26 5.37 1.04<br> J21 11.52 7.81 1.62<br> J22 14.67 10.72 2.6<br> K1 5.63 4.7 4.86<br> K2 6.74 4.58 7.23<br> K3 8.04 4.48 9.73<br> K4 9.39 4.76 11.79<br> K5 16.66 15.39 14.44<br> K6 18.72 15.18 18.23<br> K7 21.56 15.5 22.97<br> K8 23 15.02 25.37<br> K9 42.5 42.02 36.05<br> K10 44.55 41.63 39.71<br> K11 47.19 41.96 44.03<br> K12 49.9 43.14 47.21<br> K13 10.61 17.44 31.24<br> K14 24.84 13.19 21<br> K15 53.12 48.05 3.19<br> K16 1.05 1.14 1.13<br> K17 19.93 11.34 1.67<br> K18 5.3 10.47 2.73<br> K19 3.95 2.76 13.94<br> K20 30.61 26.43 11.04<br> K21 34.91 29.6 11.78<br> K22 38.95 34.57 18.4<br> L1 3.88 3.12 2.32<br> L2 4.93 3.2 2.69<br> L3 5.75 3.14 3.02<br> L4 7.31 3.79 3.4<br> L5 13.29 11.54 9.39<br> L6 16.22 11.73 10.32<br> L7 19.95 12.08 12.06<br> L8 20.79 11.31 12.01<br> L9 43.22 42.09 33.78<br> L10 45.52 41.88 34.65<br> L11 49.04 42.87 35.98<br> L12 51.03 43.83 37.78<br> L13 7.45 12.77 25.59<br> L14 21.26 10.76 17.73<br> L15 49.45 43.12 2.14<br> L16 0.47 0.49 0.5<br> L17 16.04 8.49 0.78<br> L18 2.91 6.5 1.39<br> L19 2.5 1.45 10.28<br> L20 38.7 33.98 20.86<br> L21 39.36 35.23 21.23<br> L22 41.36 38.77 23.51<br> GS0 79.47 82.51 69.04<br> GS1 72.62 74.94 59.17<br> GS2 63.15 65.11 51.57<br> GS3 54.72 56.51 45.03<br> GS4 48.1 49.81 39.24<br> GS5 42.22 43.64 34.45<br> GS6 37.33 38.7 30.5<br> GS7 32.38 33.61 26.11<br> GS8 27.56 28.7 22.11<br> GS9 22.5 23.4 17.99<br> GS10 18.77 19.55 14.83<br> GS11 15.48 16.08 12.04<br> GS12 12.69 13.29 9.98<br> GS13 10.35 10.81 7.97<br> GS14 8.39 8.77 6.37<br> GS15 6.45 6.79 4.97<br> GS16 4.95 5.18 3.7<br> GS17 3.58 3.82 2.76<br> GS18 2.76 2.89 2.06<br> GS19 1.97 2.08 1.45<br> GS20 1.22 1.31 0.98<br> GS21 1 1.05 0.74<br> GS22 0.87 0.89 0.65<br> GS23 0.34 0.32 0.32<br> <br> </font> </tt><br> <tt> <br> </tt><br> <br> </body> </html>