Home Home Applications Products Products Support Support Downloads Downloads Company Company
Applications

.CPX File Format
Description of Compix Image File Format


The .CPX format was developed for ease of use in the Visual Basic environment, and is transportable to other languages as well. It begins with 244*193 32-bit IEEE floating-point numbers representing the 244*193 pixels in the image. These numbers are degrees Celsius, uncorrected for Ambient, Emissivity, Lens Factor or Focal Distance. After the thermal data, there is an information block defined by:

Type ImageParmType
tiffFilename As String 'var len
timeOfImage As Date '8 byte floating-point in DATE.TIME format, 0.0 being dec, 30 1899, midnight'0.5 being dec 30, 1899, noon

maxVal As Single '4-bytes
scaleVal As Single '4-bytes
baseVal As Single '4-bytes

ambient As Single '4-bytes
emissivity As Single '4-bytes
lensFactor As Single '4-bytes
focalDistance As Single '4-bytes

numColor As Integer '2-bytes
colorfield(1 To 3, 0 To 256) As Byte 'many bytes 3*257
comments As String 'var len
End Type

Using the following Visual Basic code, the image and it's information block are read from disk.

DIM displayedImage(1 To 244, 1 To 193) As Single
DIM DisplayedImageParm as ImageParmType
open filename$ for binary as #1
get #1,displayedImage
get #1,DisplayedImageParm
close #1

Note: In some advanced and/or custom versions of Compix thermal evaluation software there may be four extra bytes at the very end of the .cpx file. Those four bytes, if present, specify the width and height of the image as 16-bit integer values. If this alternate format is a possibility, the reader should first read the width and height values by indexing 4 bytes ahead of the end of file. Next the reader should read (width) x (height) 32-bit floating point values for the image, read the information block, and then re-read the height and width. If the width and height read after reading the rest of the file agrees with the first reading, correct reading of the image is confirmed. If they do not agree, the file should be considered a normal .cpx file and re-read accordingly.

Temperature data storage, readout and correction
[This subsection added 10/3/02]

The temperature values saved in .TIF and .CPX files by WinTES are the uncorrected temperature data. The following function converts temperature read from the PC2000 through compix32.dll to the actual temperature of the surface which is the value reported by WinTES.

Focal distance is in inches from the bezel
Emissivity and Lens Factor are in the range [0,1]

"z" and "power" are local variables only
"e" is a local variable for total efficiency

Function realTemp(ByVal temperature As Double) As Single

If temperature = -273.15 Then
realTemp = -273.15
ElseIf temperature = -300# Then
realTemp = -300#
Else

Dim power As Double, e As Double
Dim z As Double
z = Exp(0.232345 * (focalDistance + -0.292342))
z = 0.496871 * (z - 1) / (z + 1) + 0.598322 - 0.00091283524059

Note: 0.00091283524059 is a correction factor applied to get 10" to be exactly 1.000. The rest of the equation is derived from actual data with a camera, using the curve of best fit as determined by MacCurveFit.

e = emissivity * imageStore(DISPLAYED).lensFactor * z

power = ((temperature + 273.15) ^ 4#)
power = (power - (273.15 + ambient) ^ 4# * (1 - e)) / e

If power > 0 Then
realTemp = Sqr(Sqr(power)) - 273.15
Else
realTemp = -273.15
End If
End If
End Function

Compix is a registered trademark of Compix Incorporated. Copyright © 2010 Compix Incorporated. All rights reserved.