================================================================ CCD Astrocamera formats for SBIG ST4 and ST6 ================================================================ Preamble ---------- The early CCD cameras were for astronomy buffs with a lot of money to spare, monochrome and quite small. However, they could be used for exposures lasting several minutes and were thus capable to gather the light from dim astro objects. Camera manufacturers used their own proprietary bit map image format to save the pictures, sometimes there was a diferent format for each camera model. The Santa Barbara Instruments Group (SBIG) made the Star Tracker 4 and Star Tracker 6 cameras. Initially, they were targeted to the Mac market and so there are no file extensions. However, sometimes ST4 and ST6 were used on PCs with image processing or convertion tools. ---------------------------------------------------------------- Star Tracker 4 ST4 ---------------------------------------------------------------- The ST4 uses the CCD chip TC-211 from Texas Instruments. There are 165 lines with 192 columns each. The camera digitizes the values in each pixel "bucket" with 8 bits and thus 256 shades of gray are produced. The top left pixel comes into the first byte written to the file. The pixel values are written from left to right, top to bottom. When the image data is written, a 166th line is added, containing additional information for the picture. Line 166 ---------- Bytes 1 - 79 (80): Free format text the user may enter to describe some minutes of the session that lead to the picture. Bytes 80 - 89 (10): Exposure time in 1/1000 seconds. Bytes 90 - 99 (10): Focal length of telescope in inches. Bytes 100 - 109 (10): Aperture of telescope in inches. Bytes 110 - 120 (10): Calibration factor. Bytes 120 - 192 (72): Additional information. The information contained in those 192 bytes are ansi text. The file size is always 165 x 192 + 192 = 31'680 bytes. ---------------------------------------------------------------- Star Tracker 6 ST6 ---------------------------------------------------------------- The ST6 uses the CCD chip TC-241 from Texas Instruments. There are 242 lines with 375 columns each. The camera digitizes the values in each pixel "bucket" with 16 bits. The file uses a header of exactly 2048 bytes. It contains information about the picture in text format. The first line is always either "ST-6 Compressed Image" or "ST-6 Image" if not compressed. Each line starts with a keyword, followed by a blank character, an equal sign and another blank character. Parameters to the keyword follow. The line is terminated by a CR/LF sequence (0D, 0A hex). The keyword "End" marks the end of the text area. The rest up to 2048 is padded by ascii nulls (00 hex), some programs pad with ascii blank characters, though. Sample Header --------------- ST-6 Compressed Image File_Version = 1 Data_Version = 1 Exposure = 4500 Focal_Length = 80.000 Aperture = 51.000 Response_Factor = 10000.000 Note = Image taken mm/dd/yy at hh:mm:ss Background = 688 Range = 1408 Height = 242 Width = 375 Date = mm/dd/yy Time = hh:mm:ss Exposure_stats = 38 Temperature = 10.59 Number_exposures = 1 Each_exposure = 4500 History = R Observer = Observer's name End Unfortunately, I cannot elaborate more on the header. The units to the values in particular are not clear to me. When I analyzed some ST6 files way back in the dim past, the amateur making them did not know anymore how he set the camera in the first place. Image data ------------ The top left pixel value comes into the first two bytes written to the file. The pixel values are written from left to right, top to bottom. The first byte is the low order, the second the high order part of the value (Intel format). An uncompressed file contains 375 x 242 x 2 + 2048 = 183'548 bytes. If the image data is compressed, as becomes evident from the file head, the size may vary, of course. The image data is DBE compressed. Delta Byte Encoding (DBE) --------------------------- Each of the 242 lines starts with a 2 byte word containing the byte count of the line (which would be 2 x 375 = 750 bytes without compression). The next word is the absolute pixel value for the first column of the line encoded. If the next byte has a value of 128, the following word is an absolute pixel value. If the byte value is not 128, this byte represents a signed delta offset to the previous absolute pixel value. Byte values between 0 and 127 are added to the last pixel value, byte values between 129 and 255 are substracted (two's complement -- this means, that the result of the operation 256 minus byte value must be substracted from the previous pixel value). Note that the delta value is not necessarly added to, or subtracted from, the last absolute pixel vaue, but from the last calculated pixel value. How to interpret the following data depends on the value just processed: if it was a delta byte, the next one is again a byte. If the preceeding byte value was 128, the following data must be interpreted as word containing an absolute pixel value. The following byte has again to be interpreted with the value 128 in mind. Each line is encoded this way. This means, the encoding process resets itself after each line. A decoder must read the line length word, which is the first word of each line in oder to find the start of the next line. It is possible that the file size grows larger for compressed data than for uncompressed. The software writing the file should be aware of the file size it produces in order to abandon encoding and save the image data uncompressed. REFERENCES ------------ Author -------- hans-rudolf.wernli@bluewin.ch http://mypage.bluewin.ch/horo/ 05. August 2002