================================================================ CCD Astrocamera format .LNX (Spectra Source Instruments) ================================================================ 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 different format for each camera model. One of them is the PC-Lynxx LNX format. The camera used the TC-211 CCD chip from Texas Instruments. There are 165 lines with 192 columns each. The camera digitized the values in each pixel "bucket" with 12 bits and thus 4096 grayscales were produced. The LNX format ---------------- In the LNX file, the top left pixel value (i.e. the brightnss) is the first value in the file. The pixel values are written from left to right, top to bottom. Please remember that a byte with 8 bits can also be looked at as 2 nibbles with 4 bits each -- like a 16 bit word consisting of two 8 bit bytes. There is the problem with the 12 bit value. The LNX format does not save the value as a 16 bit 2 byte word, but as two bytes and two nibbles. There are 3 bytes for 2 pixel values. Consider this as a simple data compression scheme. Each byte triplet holds two 12 bit values. The first byte takes the lower 8 bits of the first pixel value. The low order nibble of the second byte contains the high 4 bits of the first value and the high order nibble the high 4 bits of the second pixel value. The third byte finally stores the lower 8 bits of the second pixel value. And so on. +---------------------+ ¦ ¦ v v +---------------+ +---------------+ +---------------+ ¦ Byte n ¦ ¦ Byte n+1 ¦ ¦ Byte n+2 ¦ ¦ ¦ ¦ : ¦ ¦ ¦ ¦7¦6¦5¦4¦3¦2¦1¦0¦ ¦7¦6¦5¦4¦3¦2¦1¦0¦ ¦7¦6¦5¦4¦3¦2¦1¦0¦ ¦ ¦ ¦ : ¦ ¦ ¦ ¦ Pixel n, Low ¦ ¦ Pix : Pix ¦ ¦Pixel n+1, Low ¦ ¦ ¦ ¦n+1,Hi : n, Hi ¦ ¦ ¦ +---------------+ +-------+-------+ +---------------+ ^ ^ ¦ ¦ +---------------------+ The camera contains 165 * 192 = 31'680 pixels. Each pixel value takes up 1 1/2 bytes. Hence, the file size is always 47'520 bytes. REFERENCES ------------ Author -------- hans-rudolf.wernli@bluewin.ch http://mypage.bluewin.ch/horo/ 05. August 2002